安装时断电后分区消失

5 partitioning data-recovery

我的笔记本电脑上安装了 Ubuntu 14.04 LTS。一段时间后,我在启动时遇到了一些麻烦。我决定重新安装 Ubuntu。

我有 3 个 ntfs 分区,2 个 ext3 分区,第一个/和第二个的挂载点./local和一个交换分区。在重新安装过程中,我选择了选项:“擦除 Ubuntu 14.04 并重新安装”。

重新安装时断电。再次运行后,我打开笔记本电脑以尝试重新启动安装过程。除了:

  1. 擦除磁盘并安装 Ubuntu
  2. 别的东西

当我选择时,Something else 我看不到我的分区。相反,我发现了这个:

Device                         Type     Mount point     Format?     Size      Used     System   

/dev/mapper/ubuntu--vg-root
 /dev/mapper/ubuntu--vg-root   ext4                                 631381 MB unknown  Linux device-mapper (linear)(631.4 GB)
/dev/mapper/ubuntu-vg-swap_1
 /dev/mapper/ubuntu-vg-swap_1  swap                                 8493 MB   unknown
/dev/sda
 /dev/sda1                     ext2                                 254 MB    27 MB
 /dev/sda5                                                          639877 MB unknown
Run Code Online (Sandbox Code Playgroud)

在 Testdisk 阶段,我有这个:

测试盘

Eld*_*eek 5

首先要做的是获取驱动器的取证副本。完全复制驱动器使您可以灵活地修复副本上的问题,同时确保不会进一步损坏原始驱动器。我比 dd 更喜欢 dc3dd,因为 dc3dd 在运行时提供进度报告。

编辑:dd now 的较新版本包括带有 switch 的进度报告status=progress。看看你的是否确实看到man dd

1) 从 Live 媒体 USB 或 DVD 启动 - 选择 Try Ubuntu

2) 在提示符下用 CTRL - ALT - T 打开终端回车

which dc3dd

这只是查看您是否为取证图像安装了正确工具的一种快速方法。如果它以类似的路径响应

/usr/bin/dc3dd

我们有它。如果没有,我们必须安装它并输入

sudo apt-get install dc3dd 在继续第 3 步之前

3) 确定您的源(旧)驱动器的名称 这可能是 /dev/sda 但要确保在下图的 GUI 中查看磁盘,您可以看到我的 sda1 是具有 2 个 64GB 分区的 128GB 驱动器。

恢复1

4) 连接新驱动器 在 GUI 中使用磁盘验证设备名称做笔记!旧磁盘将称为源磁盘,而新磁盘将称为目标磁盘。所以在这个例子中 source=/dev/sda 和 target 将是 /dev/sdb 或它在磁盘中所说的任何内容

现在我们有了一个计划,我们将使用 dc3dd 将源复制到目标。

5)在终端发出命令

dc3dd if=/dev/sdX of=/dev/sdY更改 X 以匹配源(可能是 a)和 Y 以匹配目标(可能是 b 或 c)检查您的笔记并确保您做对了!!!

注意:要创建映像而不是克隆物理驱动器,请将 =/dev/sdY 更改为 of=diskimage.dd

虽然我们将源驱动器复制到目标驱动器以确保在出现问题时我们可以随时返回并且我们的情况不会比以前更糟,但我们可能应该熟悉一般的分区。可以在http://www.tomshardware.com/forum/270354-32-understnading-extended-logical-primary-partitions上找到一篇很好的文章这些知识将在此过程的后面有用。

6) 当复制完成关闭时,断开标有源的驱动器(旧驱动器)并将其放在安全的地方。

7) 使用带有目标(新驱动器)的 Live DVD/USB 再次启动机器。

8) 我们将安装 testdisk 来恢复目标驱动器上的分区,该驱动器现在在数据方面与源驱动器相同。

打开终端并发出命令

sudo apt-get install testdisk

9)安装完成后,我们发出命令 testdisk

以下示例步骤来自一个非常好的分步教程

One condition:

    TestDisk must be executed with Administrator privileges.

Important points for using TestDisk:

    To navigate in TestDisk, use the Arrow and PageUp/PageDown keys.
    To proceed, confirm your choice(s) with the Enter key.
    To return to a previous display or quit TestDisk, use the q (Quit) key.
    To save modifications under TestDisk, you must confirm them with the y (Yes) and/or Enter keys, and
    To actually write partition data to the MBR, you must choose the "Write" selection and press the Enter key.
Run Code Online (Sandbox Code Playgroud)

日志创建 创建日志

Choose Create to instruct Testdisk to create a log file containing technical information and messages, unless you have a reason to append data to the log or you execute TestDisk from read only media and must create the log elsewhere.
Choose None if you do not want messages and details of the process to be written into a log file (useful if for example Testdisk was started from a read-only location).
Press Enter to proceed.
Run Code Online (Sandbox Code Playgroud)

磁盘选择

TestDisk:磁盘选择应检测到所有硬盘驱动器并以正确的大小列出

Use up/down arrow keys to select your hard drive with the lost partition/s.
Press Enter to Proceed.
Run Code Online (Sandbox Code Playgroud)

分区表类型选择

TestDisk 显示分区表类型。菜单分区表类型

Select the partition table type - usually the default value is the correct one as TestDisk auto-detects the partition table type.
Press Enter to Proceed.
Run Code Online (Sandbox Code Playgroud)

当前分区表状态

TestDisk 显示菜单(另请参阅 TestDisk 菜单项)。 菜单

Use the default menu "Analyse" to check your current partition structure and search for lost partitions.
Confirm at Analyse with Enter to proceed.
Run Code Online (Sandbox Code Playgroud)

现在,列出了您当前的分区结构。检查您当前的分区结构是否缺少分区和错误。 分析

第一个分区被列出两次,它指向一个损坏的分区或一个无效的分区表条目。无效的 NTFS 引导指向错误的 NTFS 引导扇区,因此它是一个损坏的文件系统。扩展分区中只有一个逻辑分区(标签分区 2)可用。缺少一个逻辑分区。

Confirm at Quick Search to proceed.
Run Code Online (Sandbox Code Playgroud)

快速搜索分区 TestDisk 实时显示第一个结果。
快速搜索

在快速搜索期间,TestDisk 找到了两个分区,包括标记为 Partition 3 的缺失逻辑分区。 第一个结果

Highlight this partition and press p to list your files (to go back to the previous display, press q to Quit, Files listed in red are deleted entries).
Run Code Online (Sandbox Code Playgroud)

所有目录和数据都正确列出。

Press Enter to proceed.
Run Code Online (Sandbox Code Playgroud)

保存分区表还是搜索更多分区?菜单搜索!

When all partitions are available and data correctly listed, you should go to the menu Write to save the partition structure. The menu Extd Part gives you the opportunity to decide if the extended partition will use all available disk space or only the required (minimal) space.
Since a partition, the first one, is still missing, highlight the menu Deeper Search (if not done automatically already) and press Enter to proceed.
Run Code Online (Sandbox Code Playgroud)

仍然缺少分区:深入搜索

Deeper Search 还会搜索 FAT32 备份引导扇区、NTFS 备份引导超级块、ext2/ext3 备份超级块以检测更多分区,它会扫描每个柱面

Deeper Search 后,结果显示如下: 使用备份引导扇区找到第一个分区“Partition 1”。在显示的最后一行,您可以阅读消息“使用备份扇区找到 NTFS!” 和你的分区的大小。“分区 2”以不同的大小显示两次。如果您让它们列为已删除,列为 D(已删除)的分区将不会被恢复。两个分区都以状态 D 列出,表示已删除,因为它们彼此重叠。您需要确定要恢复的分区。 结果更深的搜索!

Highlight the first partition Partition 2 and press p to list its data.
Run Code Online (Sandbox Code Playgroud)

上层逻辑分区的文件系统(标签为Partition 2)被破坏
损坏的文件系统(点击拇指)。

Press q for Quit to go back to the previous display.
Let this partition Partition 2 with a damaged file system marked as D(deleted).
Highlight the second partition Partition 2 below
Press p to list its files.
Run Code Online (Sandbox Code Playgroud)

列出文件

它有效,您的文件已列出,您已找到正确的分区!

Use the left/right arrow to navigate into your folders and watch your files for more verification
Run Code Online (Sandbox Code Playgroud)

注意:FAT 目录列表仅限于 10 个簇 - 某些文件可能不会出现,但不会影响恢复。

Press q for Quit to go back to the previous display.

The available status are Primary, * bootable, Logical and Deleted.
Run Code Online (Sandbox Code Playgroud)

使用向左/向右箭头键,将所选分区的状态从 D(已选中)更改为 L(逻辑)。这样你就可以恢复这个分区。设置要恢复的分区

提示:阅读如何识别主分区和逻辑分区?注意:如果列出了 *(bootable) 分区,但如果您不从该分区启动,则可以将其更改为主分区。

Press Enter to proceed.
Run Code Online (Sandbox Code Playgroud)

分区表恢复

现在可以编写新的分区结构了。注意:扩展分区是自动设置的。TestDisk 使用不同的分区结构来识别这一点。 菜单写入

If all partitions are listed and only in this case, confirm at Write with Enter, y and OK.
Run Code Online (Sandbox Code Playgroud)

现在,分区已注册在分区表中。NTFS 引导扇区恢复

名为 Partition 1 的第一个分区的引导扇区仍然损坏。是时候修复它了。NTFS 引导扇区状态错误,备份引导扇区有效。引导扇区不相同。 备份 bs

To copy the backup of the boot sector over the boot sector, select Backup BS, validate with Enter, use y to confirm and next OK.
Run Code Online (Sandbox Code Playgroud)

有关在 TestDisk 菜单项下修复引导扇区的更多信息。显示以下消息: 备份 bs 后

引导扇区及其备份现在都正常且相同:NTFS 引导扇区已成功恢复。

Press Enter to quit.
Run Code Online (Sandbox Code Playgroud)

重启

TestDisk displays You have to restart your Computer to access your data so press Enter a last time and reboot your computer.
Run Code Online (Sandbox Code Playgroud)

来自cgsecurity 的结束指令

如果驱动器物理损坏,我们将需要使用 ddrescue 的不同方法