更改-ay

更改-ay

我有一台双启动的 Ubuntu 和 Win10 机器。Windows 被搞坏了,我使用 unetbootin 修复了它。Ubuntu 消失了,也就是说,有 Ubuntu 和 Win 的启动菜单消失了。现在我只有 Win10。

我尝试使用 unetbootin 和实时 Ubuntu 磁盘修复 Ubuntu,但没有任何效果(虽然我没有尝试高级选项,只是尝试了默认选项)。

我不太理解分区,但是我认为我的 Ubuntu 已被 Windows/unetbootin 覆盖。有什么方法可以恢复 Ubuntu?

Testdisks 显示我的分区如下所示

sda 看起来像这样

短暂性失眠!

答案1

乍一看,Windows 10 似乎没有重写驱动器的分区表,因此主引导记录只是发生了变化。您需要做的是恢复 MBR,我相信可以使用名为“gparted”的 Linux 工具来完成。您可能需要下载此工具。http://gparted.org/download.php注意它给您的所有警告。备份所有数据并备份当前(坏的)MBR。一旦您在运行 ubuntu 的 USB 中启动,您就可以从 USB 运行 gparted,或者从使用网站上提供的 ISO 制作的实时 CD 或 USB 启动。这意味着在 CD 或 USB 上制作实时 ISO 映像并从 USB 启动以运行 gparted。还有一个免费的工具可以恢复在 Windows 上运行的 MBR,但我怀疑您是否能够从 Windows 恢复旧的 MBR。始终使用备份的 MBR。Windows 安装有自己的想法。对我有用的是下载一个 ubuntu 的 ISO,它可以通过选择 USB 启动,然后在该 USB 上使用已加载的 gparted 副本。您无法使用分区管理器更改已安装的驱动器,因此请卸载驱动器以重新分区或将 MBR 更改为启动 Linux 和 Windows 的 MBR。由于您的分区表似乎仍然完好无损,我建议只制作一个双启动的新 MBR。

“访问 GParted 应用程序的所有功能的最佳方式是使用 GParted Live 可启动映像。GParted Live 可让您在 GNU/Linux 以及其他操作系统(如 Windows 或 Mac OS X)上使用 GParted。”

修复操作系统启动问题

“当您执行以下操作之一时,您的计算机可能无法启动操作系统:

Delete a partition.

Move a partition.

***Install another operating system and overwrite the Master Boot Record (MBR).*** 

幸运的是,启动失败的问题通常可以得到修复。

如果您的计算机使用 GRUB 引导加载程序,请参阅“修复 GRUB 启动问题”部分以恢复启动能力。

如果您的计算机不使用 GRUB,那么建议您查阅引导加载程序的文档以了解如何解决问题。您可以查阅 GParted FAQ 或 GParted 论坛。您也可以搜索互联网以了解其他人如何解决类似问题”

修复 GRUB 启动问题

许多 GNU/Linux 发行版都使用 Grand Unified Boot loader (GRUB)。要修复 GRUB 启动问题,首先要确定使用的是哪个主要版本的 GRUB。

GRUB 有两个主要版本:

GRUB, also known as GRUB 2, covers versions 1.98 and higher. GRUB 2 works with both GUID partition tables (GPT) and msdos partition tables.

GRUB Legacy, traditionally known as GRUB, covers versions 0.9x and earlier. GRUB Legacy works with msdos partition tables only. 

GRUB 2 在以下 GNU/Linux 发行版中用作默认引导加载程序:

CentOS 7 and higher

Debian 6 (Squeeze) and higher

Fedora 16 (Verne) and higher

openSUSE 12.2 and higher

Ubuntu 9.10 (Karmic Koala) and higher 

如果您不确定您的计算机是否使用 GRUB 2 还是 GRUB Legacy,您可以尝试在 Internet 上搜索答案。

恢复 GRUB 2 引导加载程序

使用以下步骤恢复 GRUB 2 引导加载程序:

Boot from Live media such as GParted Live or your GNU/Linux distribution image. Open a terminal window.

Determine which partition contains the / file system for your GNU/Linux distribution.

Use GParted to list the partitions on your disk device. Look for a partition that contains your GNU/Linux / file system. This Linux partition will likely use a file system such as ext2, ext3, ext4, or btrfs.

笔记

如果 / 分区位于 LVM 上,则逻辑卷管理器必须处于活动状态。可以使用以下命令启动 LVM:

更改-ay

对于 LVM,磁盘分区的等价物是逻辑卷。可以使用以下命令列出逻辑卷:

lvscan

 Create a mount point directory by entering (as root):

# mkdir /tmp/mydir

Mount the / partition on the mount point directory. For example assume the / file system is contained in the /dev/sda5 partition. Enter (as root):

# mount /dev/sda5 /tmp/mydir

If you have a separate /boot partition, for example at /dev/sda3, then an extra step is required. Mount the /boot partition at /tmp/mydir/boot by entering (as root):

# mount /dev/sda3 /tmp/mydir/boot

Note

If you do not know whether you have a separate boot partition then you probably do not and can ignore this step.

Prepare to change the root environment by entering (as root):

# mount --bind /dev /tmp/mydir/dev

# mount --bind /proc /tmp/mydir/proc

# mount --bind /sys /tmp/mydir/sys

Change the root environment by entering (as root):

# chroot /tmp/mydir

Reinstall GRUB 2 on the boot device. Note that the device name is used and not the partition name. For example, if the / partition is /dev/sda5 then the device is /dev/sda.

For Debian, Ubuntu, and other offshoot GNU/Linux distributions, enter the command (as root):

# grub-install /dev/sda

For CentOS, Fedora, openSUSE and other offshoot GNU/Linux distributions, enter the command (as root):

# grub2-install /dev/sda

Exit the chroot environment by entering (as root):

# exit

Reboot your computer. 

恢复 GRUB 传统引导加载程序

使用以下步骤恢复 GRUB Legacy 引导加载程序:

Boot from Live media such as your GNU/Linux distribution image. Open a terminal window.
Note

The Live media must contain the GRUB Legacy boot loader. If your GNU/Linux distribution uses GRUB Legacy, then the distribution Live media will also contain GRUB Legacy.

Start the grub application from the command line (as root).

# grub

Find where grub stage1 is located by using one of the following:

If the /boot folder is stored in the / partition, use the command:

grub> find /boot/grub/stage1

If the /boot folder is stored in a partition different than the / partition, use the command:

grub> find /grub/stage1

The output from the find command might look like the following:

 (hd0,0)

If more than one line is listed in the command output, you will need to decide which device you use for grub.

Set the grub root device by specifying the device returned by the find command.

grub> root (hd0,0)

Reinstall grub by specifying the device returned by the find command.

grub> setup (hd0,0)

Exit grub.

grub> quit

Reboot your computer. 

*****************************************************8

***强文***RTFM!!

相关内容