centos6上誤刪除了文件怎樣恢復?node
建立一個新磁盤 /dev/sdb,建立分區 /dev/sdb1,格式化,掛載到 /tmp/sdb1上c++
mkdir /tmp/sdb1 cp /etc/passwd /tmp/sdb1/ cp /etc/hosts /tmp/sdb1/ mkdir -p /tmp/sdb1/a/b/c echo aaa > /tmp/sdb1/a.txt echo bbb > /tmp/sdb1/a/b/b.txt touch /tmp/sdb1/a/b/kong.txt cd /tmp/sdb1/ rm -rf a a.txt hosts passwd
yum install e2fsprogs-devel -y cd /usr/local/src/ wget https://sourceforge.net/projects/extundelete/files/latest/download/extundelete-0.2.4.tar.bz2 tar jxvf extundelete-0.2.4.tar.bz2 cd extundelete-0.2.4 yum install gcc-c++ -y ./configure --prefix=/usr/local/extundelete && make && make install
umount /tmp/sdb1/
/usr/local/extundelete/bin/extundelete /dev/sdb1/ --inode 2
/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-all
經常使用選項centos
/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-inode 12 /usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-file passwd /usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-directory a
查看 extundelete 的幫助信息ide
/usr/local/extundelete/bin/extundelete -h