我正在尝试恢复我不小心删除的包含许多文件的目录。具有讽刺意味的是,这是尝试设置备份时的一个胖手指错误!我正在按照说明进行操作这里:
ext4magic命令生成直方图成功:
[root] /mnt/reos-storage-2 $ ext4magic /dev/sda2 -H -a $(date -d "-70minutes" +%s)
Filesystem in use: /dev/sda2
|-----------c_time Histogram----------------- after -------------------- Wed Jun 23 10:42:35 2021
1624441775 : 0 | | Wed Jun 23 10:49:35 2021
1624442195 : 43 |**************************************************| Wed Jun 23 10:56:35 2021
1624442615 : 0 | | Wed Jun 23 11:03:35 2021
1624443035 : 1 |** | Wed Jun 23 11:10:35 2021
1624443455 : 0 | | Wed Jun 23 11:17:35 2021
1624443875 : 3 |**** | Wed Jun 23 11:24:35 2021
1624444295 : 0 | | Wed Jun 23 11:31:35 2021
1624444715 : 0 | | Wed Jun 23 11:38:35 2021
1624445135 : 0 | | Wed Jun 23 11:45:35 2021
1624445555 : 0 | | Wed Jun 23 11:52:35 2021
|-----------d_time Histogram----------------- after -------------------- Wed Jun 23 10:42:35 2021
1624441775 : 0 | | Wed Jun 23 10:49:35 2021
1624442195 : 0 | | Wed Jun 23 10:56:35 2021
1624442615 : 1 |* | Wed Jun 23 11:03:35 2021
1624443035 : 9380 |**************************************************| Wed Jun 23 11:10:35 2021
1624443455 : 0 | | Wed Jun 23 11:17:35 2021
1624443875 : 0 | | Wed Jun 23 11:24:35 2021
1624444295 : 1 |* | Wed Jun 23 11:31:35 2021
1624444715 : 0 | | Wed Jun 23 11:38:35 2021
1624445135 : 0 | | Wed Jun 23 11:45:35 2021
1624445555 : 0 | | Wed Jun 23 11:52:35 2021
|-----------cr_time Histogram----------------- after -------------------- Wed Jun 23 10:42:35 2021
1624441775 : 0 | | Wed Jun 23 10:49:35 2021
1624442195 : 33 |**************************************************| Wed Jun 23 10:56:35 2021
1624442615 : 1 |** | Wed Jun 23 11:03:35 2021
1624443035 : 0 | | Wed Jun 23 11:10:35 2021
1624443455 : 0 | | Wed Jun 23 11:17:35 2021
1624443875 : 0 | | Wed Jun 23 11:24:35 2021
1624444295 : 0 | | Wed Jun 23 11:31:35 2021
1624444715 : 0 | | Wed Jun 23 11:38:35 2021
1624445135 : 0 | | Wed Jun 23 11:45:35 2021
1624445555 : 0 | | Wed Jun 23 11:52:35 2021
ext4magic : EXIT_SUCCESS
然而,任何进一步的命令基本上都会以段错误结束
[root] /mnt/reos-storage-2 $ ext4magic /dev/sda2 -a 1624442615 -f r sftp_data -l
Filesystem in use: /dev/sda2
Using internal Journal at Inode 8
Activ Time after : Wed Jun 23 11:03:35 2021
Activ Time before : Wed Jun 23 11:56:09 2021
Segmentation fault
有什么我可以做的吗?
更多背景
作为背景,我大致通过以下步骤达到了这一点。
经过疯狂的谷歌搜索后,我尽快卸载了文件系统。最初我这样做是用
umount -l /mnt/reos-storage-1
我使用该-l
选项是因为 umount 无法卸载仍在使用的分区。接下来我做了
fuser -cuk /mnt/reos-storage-1/
接下来我跑了
fsck /dev/sda2
实际上 ext4magic 并不推荐这样做。
extundelete
接下来我尝试恢复失败的文件
[root] /mnt/reos-storage-2 $ extundelete --restore-directory /mnt/reos-storage-1/sftp_data /dev/sda2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 29027 groups loaded.
Loading journal descriptors ... 0 descriptors loaded.
extundelete: Extent block checksum does not match extent block while finding inode for mnt
extundelete: Extent block checksum does not match extent block while finding inode for mnt
Failed to restore file /mnt/reos-storage-1/sftp_data
Could not find correct inode number past inode 2.
Try altering the filename to one of the entries listed below.
File name | Inode number | Deleted status
extundelete: Operation not permitted while restoring directory.
extundelete: Operation not permitted when trying to examine filesystem
[root] /mnt/reos-storage-2 $ man umount
[root] /mnt/reos-storage-2 $ extundelete --restore-all /dev/sda2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 29027 groups loaded.
Loading journal descriptors ... 0 descriptors loaded.
Searching for recoverable inodes in directory / ...
0 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.
No files were undeleted.
然后我使用 apt 安装了 ext4magic 并按照说明运行以下命令来备份日志
debugfs -R "dump <8> /tmp/sda2.journal" /dev/sda2