Source: http://www.switchroot.com/how-to-recover-a-deleted-file-in-ext3-or-ext4-filesystem
Note: you need an account with root priviledges.
1) First install the following packages with yum:
Note: you need an account with root priviledges.
1) First install the following packages with yum:
[test@server ~]$ sudo yum install -y e2fsprogs e2fsprogs-libs e2fsprogs-devel gcc-c++
2) Download extundelete from https://sourceforge.net/project/platformdownload.php?group_id=260221
[test@server ~]$ cd /tmp
[test@server tmp]$ wget https://sourceforge.net/project/platformdownload.php?group_id=260221
3) Run the following commands to extract and install the downloaded file:
[test@server tmp]$ tar -xvjf extundelete-0.2.0.tar.bz2
[test@server tmp]$ cd extundelete-0.2.0
[test@server extundelete-0.2.0]$ ./configure
[test@server extundelete-0.2.0]$ make
[test@server extundelete-0.2.0]$ sudo make install
4) Now, extundelete is installed.
5) To recover a file, it is recommended that we should first unmount the partition from which you deleted the file or mount it in read only mode:
(Lets say here the partition is /dev/sda6 which is mounted on /test )
To mount it in read only mode:
5) To recover a file, it is recommended that we should first unmount the partition from which you deleted the file or mount it in read only mode:
(Lets say here the partition is /dev/sda6 which is mounted on /test )
To mount it in read only mode:
[test@server ~]$ sudo mount -o remount,ro /dev/sda6
OR to umount the device:
[test@server ~]$ umount /dev/sda6
6) Now, to recover a specific file, we have to type the path of file with the extundelete command. path should be from root of that filesystem (but should not contain a / in beginning).
For example: If the file /test/abc/xyz was deleted then path will be abc/xyz as /test is the mount point (root) of that filesystem. So run:
For example: If the file /test/abc/xyz was deleted then path will be abc/xyz as /test is the mount point (root) of that filesystem. So run:
[test@server ~]$ cd /tmp
[test@server tmp]$ sudo /usr/local/bin/extundelete --restore-file abc/xyz /dev/sda6
7) It will create a directory RECOVERED_FILES at current location having all the recovered files into it. - See more at: http://www.switchroot.com/how-to-recover-a-deleted-file-in-ext3-or-ext4-filesystem#sthash.KwuA2Ndd.dpuf
No comments:
Post a Comment