我在 1TB SSD 上安装了加密的 Ubuntu 14.04(完整驱动器,不仅仅是主目录)。我知道解密所有内容的密钥。现在只需找到文件即可。事情是这样的;昨天,在安装了该 SSD 的同一台计算机上,我插入了另一个安装了全新 Windows 7 Ultimate 的 SSD,以测试 Windows 键盘是否正常工作。它确实正常工作,所以我完成了这项工作(没有触碰 Ubuntu SSD),关闭了计算机,拔下了装有 Windows 7 的 SSD,然后继续正常启动。我刚这样做,就进入了 Grub Rescue“进入救援模式...”,从那以后就一直卡在那里。我整个上午都在 Google 上搜索,试图找到一个解决方案来重新进入 Ubuntu,但我不知所措。以下是我在 grub rescue 中尝试过的命令以及它们返回的内容:
grub rescue> ls
(hd0) (hd0,msdos5) (hd0,msdos1)
grub rescue> ls (hd0)
(hd0): Filesystem is unknown.
grub rescue> ls (hd0,msdos1)
(hd0,msdos1): Filesystem is ntfs.
grub rescue> ls (hd0,msdos5)
(hd0,msdos5): Filesystem is ntfs.
grub rescue> ls (hd0,5)/boot
error: file '/boot' not found.
grub rescue> ls (hd0,1)/boot
error: file '/boot' not found.
grub rescue> ls (hd0,msdos5)/boot
error: file '/boot' not found.
grub rescue> ls (hd0,msdos1)/boot
error: file '/boot' not found.
我确实尝试过从启动修复磁盘运行推荐修复,但没有任何变化,尽管应用程序说修复过程成功了。我并没有尝试双启动这个系统,Ubuntu 是这个 SSD 上唯一的系统。此时,我只是试图恢复我的文件。
这是我正在尝试恢复的 /dev/sda:
$ sudo fdisk -l
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/loop0: 1.3 GiB, 1433468928 bytes, 2799744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2ca9a8a1
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 7 HPFS/NTFS/exFAT
/dev/sda2 1001470 1953523711 1952522242 931G 5 Extended
/dev/sda5 1001472 1953523711 1952522240 931G 7 HPFS/NTFS/exFAT
我尝试通过 LiveCD USB 驱动器(在尝试 Ubuntu 中)进行 ecryptfs 恢复,并得到以下结果:
$ sudo ecryptfs-recover-private
INFO: Searching for encrypted private directories (this might take a while)...
find: '/run/user/999/gvfs': Permission denied
find: File system loop detected; 'sys/kernal/debug/pinctrl' is part of the same file system loop as '/sys/kernal/debug'.
它似乎不想找到加密文件。当我尝试浏览驱动器时,我看到的只有 $RECYCLE.BIN 和 System Volume Information 文件夹。我的驱动器中大约有一半的内容,所以如果我们能找到我的内容,我正在寻找大约 500GB 的恢复。有人可以帮忙吗?
答案1
它是使用 LUKS 加密的吗?我在 SSD 上的 LUKS 容器中运行 Ubuntu 14.04。启动并运行后,/boot 未加密,但其他所有内容都已加密。因此 df -h 报告 /dev/sda1 为 /boot 的源,/dev/dm-1 为 / 的源。dm-1 的实际容器是 /dev/sda5
如果您确实有 LUKS,您应该能够启动到救援磁盘,并使用cryptsetup
它来访问它。
cryptsetup open <device> <mapping name>
用于打开设备(因此允许我从通过 LiveCD 启动的系统挂载 /dev/sda5)
cryptsetup isLuks <device>
会告诉你该设备是否是 LUKS
cryptsetup repair <device>
可能会修复您的分区。就我个人而言,我已经获取并通过电子邮件向自己发送了 luks 标头的加密副本,因此如果标头损坏,我仍然可以修复磁盘。
您在 LiveCD 上的 /proc/partitions 中看到了什么?在我看来,您似乎拥有与我相同的分区设置,尽管分区类型不同。
您可能会发现 sda1 实际上是 /boot,而 sda5 是您的加密驱动器。在我的系统上,fdisk 报告 sda1 和 sda5 的 ID 为 83。您的系统已将其更改为 7。您应该能够将它们改回来,而不会损坏任何数据。如果它们是错误的,它可能会混淆引导加载程序,就像您的情况一样。fdisk
/dev/sda t 1 83 t 5 83 w q 应该可以测试一下。如果它有效,您应该能够重新启动,就像最初那样。如果不行,请再次运行它,并将分区 1 和 5 上的类型改回 7,然后您就回到了开始的位置。