應用linux自帶工具debugfs恢復誤刪文件方法演示node
若提示權限問題沒法打開分區,請使用root權限打開debugfs工具。linux
/home/cj/不可以使用~/替代ruby
ls -d 後會出現以下信息,找到刪除文件1.c,記錄下尖括號內的數值,按q回到debugfs。ide
而後使用logdump命令,並使用quit退出debugfs以下工具
[lishilong@headnode ~]$ dd if=/dev/sda1 of=/home/cj/Documents/debugfs_example/1.c bs=128 count=1 skip=6295411 +0 records in1 +0 records out128 bytes copied, 0.000390194 s, 328 kB/s
bs值爲offset
skip值爲block
此時文件恢復成功ui