Tuesday, 28 July 2015

j2restore:Restore your mistakenly deleted files in jfs2 file system

Sometimes we mistakenly delete files under AIX.

In fact I do have such awkward experience that I run "rm foo *" although my intention is "rm foo*".
Now I want to provide my tool named j2restore which can help you if your deleted file is in a jfs2 file system.
# ./j2restore

Usage: j2restore [-r] [-i inode-number] [-v]
-r means report mode. It will report detail info for those deleted files under this file system and do nothing else.
-i inode-number means only restore/report the specific file whose inode number is inode-number
-v print j2restore version and author info file system name, for example:  /home, /dev/hd1, etc. 
Examples:
1. To restore all deleted files under /home, type:
 j2restore /home
2. To restore inode 81  under /usr, type:
 j2restore -i 81 /usr
3. To report what files are deleted under /dev/hd3, type:
  j2restore  -r /dev/hd3
Note:
1.  The fs must be unmounted before run j2restore.
2.  After restore files using j2restore, the fs will be corrupted unless you use "-r" option, so we must run "fsck -y  ".
     Then we will find the restored files under  lost+found directory.
3.  j2restore could not restore deleted files if their disk block is re-used by other file. So you'd better un-mount fs as soon as possible when you find some files are mistakenly deleted.
4.  Pls do not test this tool in your important system. I will take NO responsibility for any possible damage caused by j2restore.
5.  Pls give me recommendation or comment if you have any problem when you use j2restore.
Update: since v1.2 is available, I delete this old version)
Changelog:  version 1.1  2013-02-13

New function of v1.1:
Check disk blocks of deleted file.
If any block has been reused by other file,
j2restore will not restore it since it is not complete.        

Downloads: j2restore v1.3.2

New function of j2restore v1.3:
1. provide all possible directory and file name info for restored inodes.
2. restore partial over-written inodes, and report what blocks were over-written.
3. intelligently scan disk blocks thus j2restore can restore all un-overwritten inodes
4. support online restore(i.e, without umount)
For aix 5.3:
j2restore1.3.2    j2restorelist 1.3.2
For aix6.1/7.1:
j2restore 1.3.2   j2restorelist 1.3.2

No comments:

Post a Comment