删除Ubuntu后无法启动XP的解决办法

来源:互联网 发布:淘宝数据作战室 编辑:程序博客网 时间:2024/05/19 01:32

转自:http://hi.baidu.com/lank/blog/item/d9d387017c6250df267fb5a7.html

鉴于之前安哥电脑删除Ubuntu后无法正常启动XP,而且根据我以前的文章中提到的:使用mbrfix.exe来修复windows的MBR,这个方法无法解决他的问题后,决定利用自家的电脑来再做一次小白鼠。


我电脑是XP+Ubuntu双系统,仿照安哥的旧路,在Windows下用磁盘管理器删除Ubuntu的分区,并格式化为Fat32,再用魔术分区大师将分区合并到Windows下的邻分区(这一步是我自己加的,因为直接删除后在利用mbrfix是可以修复的,合并分区目的是让grub找不到menu.lst),重启机器,果然,问题出现:

GRUB loading please wait

Error17

随后重启机器,放入Ubuntu的liveCD,输入:

sudo grub

find /boot/grub/stage1 【以我的机器为例,回车后,终端的返回值是(hd0,9),并记住该值,即下面代码中x=0,y=9】

root (hdx,y)

setup (hd0,0)【即放入第一个硬盘的第一个分区】

quit

重启,取出liveCD,随后就可以看见正常的选择操作系统的界面了,但Ubuntu已经删除了,menu.lst的内容怎么还显示出来?继续!上文提到魔术分区大师终于出现,分区工作开始!完成后reboot。新问题出现:

GRUB loading please wait

Error22

这倒是我始料未及的问题,估计是windows的MBR又损坏了,重复以上步骤,行不通。随后用liveCD上网,参阅本文第2页的部分内容:

补充几个用 Ubuntu livecd 的办法

方法1, sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

方法2, sudo lilo -M /dev/sda

方法3,sudo ms-sys -m /dev/sda (需要到 http://ms-sys.sourceforge.net/ 下载编译 ms-sys ,或者用下面附的 deb 包直接安装 - hardy 以前是可以直接 apt-get install ms-sys 的,后来微软死【被屏蔽】的说里面那不到 500 字节的 mbr 代码是有版权的,这个包只好从源里移除了)

它们做出来的分别是 syslinux 的 mbr,lilo 的 mbr,和正宗的 M$ mbr,都可以直接引导活动分区里的 windows

我使用方法3,即下载帖子的附件:ms-sys_2.1.0-1_i386.deb

然后在liveCD中输入sudo ms-sys -m /dev/sda

返回值:windowsXP………………(具体的忘记了-_-b  反正是好了……)

reboot,OK!

我的小白鼠正常恢复到单XP的操作系统,Ubuntu的影子彻底不见,之前分出去的8G分区也安全地合并。

使用Ubuntu这么久,没少因为grub损坏启动不了系统而受苦。grub恢复的帖子,论坛里面太多了,这里就不提。
如果你想彻底删除grub,有以下两种方法供参考:
一、windows 光盘:
将Windows的安装盘放入计算机以后,重启计算机,进入Windows安装程序,随后,进入恢复控制台,输入命令fixmbr即可。
二、mbrfix
1、下载mbrfix
http://www.linuxidc.com/Linux/2007-11/8785.htm

(MBRFix )
2、解压
将压缩包(mbrfix.zip)解压至系统根目录 C:\
3、修复mbr
a.使用Windows PE光盘启动,进入系统
b.进入cmd命令窗口
c.然后进入mbrfix工具所在的目录
引用:
cd \
d.运行mbrfix修复命令
windows XP
引用:
MBRFix /drive 0 fixmbr /yes
windows vista
引用:
MbrFix /drive 0 fixmbr /vista /yes

附:MBRFix命令:(参考:http://www.sysint.no/nedlasting/mbrfix.htm)

PS:本人使用的是这个方法,将fixmbr工具考到装有PE的优盘里,然后启动windows PE,使用上面的命令,轻松搞定。改谢楼主。

引用:
MbrFix /drive <num> driveinfo Display drive information
MbrFix /drive <num> drivesize Returns drive size in MB as return value
MbrFix /drive <num> listpartitions Display partition information
MbrFix /drive <num> savembr <file> Save MBR and partitions to file
MbrFix /drive <num> restorembr <file> Restore MBR and partitions from file
MbrFix /drive <num> fixmbr {/vista} Update MBR code to W2K/XP/2003 or Vista
MbrFix /drive <num> clean Delete all partitions in MBR
MbrFix /drive <num> readsignature {/byte} Read disk signature from MBR
MbrFix /drive <num> writesignature <hex> Write disk signature to MBR
MbrFix /drive <num> generatesignature Generate disk signature in MBR
MbrFix /drive <num> readstate Read state from byte 0x1b2 in MBR
MbrFix /drive <num> writestate <state> Write state to byte 0x1b2 in MBR
MbrFix /drive <num> readdrive <startsector> <sectorcount> <file>
Save sectors from drive to file
MbrFix /drive <num> /partition <part> fixbootsector <os>
Update Boot code in boot sector
MbrFix /drive <num> /partition <part> getpartitiontype
Get partition type
MbrFix /drive <num> /partition <part> setpartitiontype <typenum>
Set partition type
MbrFix /drive <num> /partition <part> setactivepartition
Set active partition
MbrFix /drive <num> getactivepartition Get active partition
MbrFix volumeinformation driveletter Get volume information for partition
MbrFix flush {driveletter(s)} Flush files to disk for partition
MbrFix listpartitiontypes List partition types
Drive numbering <num> starts on 0.
Partition numbering <part> starts on 1.
Commands restorembr, fixmbr, generatesignature, writestate, clean, setactivepartition and fixbootsector will ask for confirmation unless /yes is included.
If the /byte option is given for the readsignature command, the signature is returned as a byte array instead of as a DWORD. Writesignature requires the new signature to be specified as 8 hex digits.
If /vista is used with the fixmbr command, a Windows Vista MBR is written instead of a Win2000/XP/2003 MBR. The Vista MBR should work with the other OS'es as well.
原创粉丝点击