格式化Linux分区后而导致WINDOWS不能启动,这是新手常遇到的问题,感觉Linux不好,想退出,就要直接格式化Linux分区,覆盖Grub;而装了Windows与Linux双系统的用户,又会在重装Windows时把Grub覆盖掉,需要恢复Grub。这是后路,我们在做事之前需要先考虑好的。
删除Linux,覆盖Grub,还原成XP自带的启动引导,这个很简单,只要你有Windows XP盘(非Ghost),用它启动,至选择安装位置的地方退出重启就可以。或者用它启动故障修复台,运行fixboot或者fixmbr都可以。
而恢复Grub,其实也很简单的:用Live CD(对于Ubuntu来说就是Desktop CD或者DVD)启动,打开终端(Applications──>Accessory──>Terminal),执行以下代码: 
代码: 
sudo grub                                
find /boot/grub/stage1 
root (hdX,Y) 
setup (hdX) 
quit 
注意:其中的X、Y是执行find /boot/grub/stage1命令后系统提示的。,比如: 
代码: 
grub> find /boot/grub/menu.lst 
 (hd0,7) 
注意:这里的grub>是执行sudo grub命令后进入grub环境得到的提示符,不用输入。这时,X就是0,Y就是7。
下面详细解释一下这几条命令:
sudo grub 以root用户身份启动grub,否则会出错,错误见后文 
find /boot/grub/stage1 寻找/boot所在分区,其实换用find /boot/grub/menu.lst也一样。 
root (hdX,Y) 设置硬盘hdX的根文件系统(root Device),实际就是设置/boot所在的分区 
setup (hdX) 自动安装GRUB到硬盘hdX。 
quit 退出GRUB 
root、setup命令后都有空格,如果没有会出错误。 
如果不以root用户身份会出现什么样的错误呢? 
引用: 
ubuntu@ubuntu:~$grub 
[ Minimal BASH-like line editing is supported. For 
the first word, TAB lists possible command 
completions. Anywhere else TAB lists the possible 
completions of a device/filename. ] 
grub> find /boot/grub/stage1
Error 15: File not found
grub> find /boot/grub/menu.lst
Error 15: File not found
grub> root(hd0,7)
Error 27: Unrecognized command
grub> root (hd0,7)
Error 21: Selected disk does not exist 
grub> setup (hd0) 
Error 12: Invalid device requested

