电脑中安装了Windows+ubuntu+ubuntu三系统,现在要卸载其中一个ubuntu。
1. 格式化磁盘
在 windows磁盘管理 中格式化ubuntu所在的硬盘,并将空间分配到其它盘中。
2.重新指定引导文件
删除后,系统无法启动,出现图1所示的界面:
GNU GRUB version 2.04
Minimal BASH-like editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions.
grub>_
解决方法(结果如图2):
#输入ls查看引导驱动器
grub> ls
#系统会列出磁盘的各个分区
(proc) (hd0) (hd0,gpt2) (hd0,gpt1)...
#再次使用ls查看各个分区中是否有引导文件
grub> ls (hd0,gpt1)/boot/grub
#如果该分区没有引导文件,提示如下。此时应该试试其他分区
error: file `/boot/grub' not found.
#如果该分区有引导文件,系统将会一一列出
#确定好有引导文件的分区(我是(hd0,gpt2))以后,输入以下命令
grub> set root=(hd0,gpt2)
grub> set prefix=(hd0,gpt2)/boot/grub
grub> insmod normal
grub> normal
3.更新grub文件
进入ubuntu系统以后,我们需要更新grub文件,否则下次还是不能直接启动系统。
更新方法:
打开一个终端,输入:
#更新grub文件
sudo update-grub
#将文件写入引导驱动器中
sudo grub-install /dev/sda
结果如图3所示,重启以后即可显示grub菜单。