LinuxHowRestoreDeleted files? Let's see how the author solves this problem!
The data of 10 Gb was deleted by mistake and almost collapsed. I tried all the conventional recovery software and it was useless. When I had to give up, I found the ext3grep open source stuff!
Data can be restored smoothly, so data deletion in linux is not terrible. What's terrible is that there is no restoration method after deletion. Let's take a look at the following operations!
- [root@localhost ~]# uname -a
- Linux localhost.localdomain 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux
In fact, it doesn't matter what version of the system!
Required Libraries
- [root@localhost ~]# rpm -qa |grep e2fsprogs
- e2fsprogs-libs-1.39-8.el5
- e2fsprogs-1.39-8.el5
- e2fsprogs-devel-1.39-8.el5
A e2fsprogs-libs is required, otherwise there will be problems with the installation of ext3grep later.
Partition:
- [root@localhost ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/VolGroup00-LogVol00
- 6.2G 1.8G 4.2G 30% /
- /dev/sda1 99M 11M 83M 12% /boot
- /dev/mapper/VolGroup00-LogVol02
- 1008M 34M 924M 4% /data
- tmpfs 125M 0 125M 0% /dev/shm
Software required
Http://code.google.com/p/ext3grep/downloads/list
Download Software first
- [root@localhost ~]# cd /root/src/
- [root@localhost src]# wget http://ext3grep.googlecode.com/files/ext3grep-0.6.0.tar.gz src
- [root@localhost src]# ls
- ext3grep-0.6.0.tar.gz
- [root@localhost src]# tar xfvz ext3grep-0.6.0.tar.gz
- [root@localhost ext3grep-0.6.0]# ./configure
- [root@localhost ext3grep-0.6.0]# make install
- [root@localhost ext3grep-0.6.0]# ext3grep
- Running ext3grep version 0.6.0
Compile the program and test the program. After all the tasks are completed, start the recovery process.
My directory is/data Partition. I first formatted the partition. I put a file in the root directory and a file in a subdirectory.
/dev/mapper/VolGroup00-LogVol02 1008M 34M 924M 4% /data
The following italics are not mandatory:
In fact, it doesn't matter what partition is used here. You can also simulate it. The following is a simulation step:
- mkdir /data1/
- cd /data1/
- dd if=/dev/zero of=disk1 count=2048000
- mkfs.ext3 disk1
- mkdir -p /dfs/a
- mount -o loop /data1/disk1 /dfs/a
Here, we use the/data Partition to copy some files first.
- [root@localhost ~]# ]# cp /bin/ls /data/
- [root@localhost ~]# ]# cp -rf /bin /data/
- [root@localhost ~]# ]# ls -la /data/
- total 136
- drwxr-xr-x 4 root root 4096 Apr 21 17:37 .
- drwxr-xr-x 25 root root 4096 Apr 21 17:11 ..
- drwxr-xr-x 2 root root 4096 Apr 21 17:37 bin
- drwx—— 2 root root 16384 Apr 21 17:15 lost+found
- -rwxr-xr-x 1 root root 93560 Apr 21 17:37 ls
- [root@localhost ~]#
One sub-directory and one Executable File
Now delete the ls file and zcat under the bin
- [root@localhost ~]# rm /data/ls
- rm: remove regular file `/data/ls’? y
- [root@localhost ~]# rm /data/bin/zcat
- rm: remove regular file `/data/bin/zcat’? y
- [root@localhost ~]# ls -la /data/ls /data/bin/zcat
- ls: /data/ls: No such file or directory
- ls: /data/bin/zcat: No such file or directory