安装后维修指南再次双系统xp、win7、ubuntu

在本文中,主机为单个硬盘,三个步骤。

第一步:

使用liveCD要么u盘引导计算机进入ubuntu。这里最好是确保两个系统版本号之间的一致性。

菜单 System -> Administration ->Disk Utility 视图ubuntu的根分区号,比如 /dev/sda6.

【假设独立挂在 boot分区。则记住 boot分区的分区号】

通过快捷键 CTRL+ALT+T调出终端。

运行命令:

sudo -i
mount /dev/sda6 /mnt
写下以下这条命令的结果:
uname -r
运行命令:

grub-install --root-directory=/mnt /dev/sda
重新启动电脑。

第二步:

假设为ubuntu9.10的系统,系统重新启动后可能出现的就是黑屏shell输入界面:

sh:grub>
此时运行例如以下命令来查看分区情况,了解boot所在的分区号:

ls -l
依据结果,再运行
sh:grub> root (hd0, 6)
备注:上面的6是依据详细情况查看得到的。

接着运行:

sh:grub> linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda6
备注:此处2.6.35-22-generic是上面提到的 uname -r的运行结果。

接着运行:

sh:grub> initrd /boot/inttrd.img-2.6.35-22-generic
运行以下的指令进入系统:

sh:grub> boot
假设为ubuntu-10.10的系统。重新启动时此时是能够看到重装系统曾经的引导菜单。

选择ubuntu系统启动。


第三步:

通过快捷键 CTRL+ALT+T调出终端,

运行命令:

sudo update-grub2

假设是ubunt-9.10的系统,则再继续运行以下的指令:

sudo grub-install /dev/sda

到此,修复完毕。

jason@ubuntu:~$ sudo update-grub
[sudo] password for jason: 
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done


版权声明:本文博客原创文章,博客,未经同意,不得转载。

原文地址:https://www.cnblogs.com/mengfanrong/p/4716090.html