linux誤刪文件恢復(fù)方法
1、執(zhí)行命令“cd /home”進(jìn)入服務(wù)器根目錄home;

2、執(zhí)行命令“ touch demo.txt”創(chuàng)建一個(gè)演示文稿;

3、執(zhí)行命令“ rm -rf demo.txt ”刪除該文件;

4、執(zhí)行命令“ debugfs ”運(yùn)用系統(tǒng)自帶恢復(fù)工具debugfs來修復(fù);

5、額外開一個(gè)xshell,執(zhí)行命令“ df /home/ ”打開剛剛被刪除文件所在分區(qū);

6、執(zhí)行命令“ open /dev/mapper/vg_root-lv_root ”查看目錄分區(qū);

7、執(zhí)行命令“ ls -d /home ”顯示被刪除文件所在目錄;

8、執(zhí)行命令“ logdump -i”查找文件所在區(qū)塊號;

9、記住上圖block后面的數(shù)值并執(zhí)行命令“ quit ”退出debugfs;

10、執(zhí)行命令“ dd if=/dev/mapper/vg_root-lv_root of=/home/demo.txt bs=640 count=1 skip=1089 ”恢復(fù)文件操作;

11、bs與上圖offset值一致,skip與block值一致,執(zhí)行命令“ ls ”可以看到文件demo.txt被刪除后又重新找回來了,恢復(fù)成功。

以上就是linux誤刪文件恢復(fù)的方法,希望對大家有所幫助!