帮H同学折腾笔记本,
要求安装WinXP/Win2K3/Win2K8/Ubuntu/Leopard多启动。
目前解决了WinXP/Win2K3/Win2K8/Ubuntu的安装和多启动。
安装的过程是
Win XP -> Win 2K3 -> Win 2K8 -> Ubuntu
默认的引导流程是
GRUB (Ubuntu/Win2k8) -> BootMgr (Win2k8/Earlier Win) -> NTLDR (Win2k3/XP)
但是,因为从GRUB到XP需要经过一个BootMgr,个人觉得比较繁琐,
并且,后面要安装的Leopard的chain0文件用BootMgr/NTLDR引导比较方便,
于是有了将BootMgr恢复到MBR的想法(此时MBR已经被GRUB覆盖了),
首先是备份GRUB的MBR代码,在Ubuntu里面执行
dd if=/dev/sda of=~/linux.bin bs=512 count=1
并将~/linux.bin复制到Windows能访问的分区里面(我复制到c:\)
对于GRUB的引导,你可以有两个选择,
1. NTLDR -> GRUB
到XP或者2K3里面,
编辑c:\boot.ini文件(需要去除隐藏和系统两个属性),在末尾加入行
c:\linux.bin=”Ubuntu Desktop 8.10″
2. BootMgr -> GRUB
或者到win2k8里面,开始->运行->cmd->bcdedit,然后执行(runas admin)
bcdedit /create /d “Ubuntu Desktop 8.10” /application bootsector
执行后会回馈一个{id},请代入下列命令
bcdedit /set {id} device partition=C:
bcdedit /set {id} path \gdldr.mbr
bcdedit /displayorder {id} /addlast
bcdedit /default {id}
OK,接下来就是恢复BootMgr的MBR代码了。
在这一步遇到了不少问题,
不管是G.cn还是百度,都无法给出满意的处理办法,
不少人在琢磨 bootsect 的用法,但是 bootsect 无法写入到MBR。
正当无聊的时候,我用Win2k8光盘启动,进入修复程式->Command Prompt,
不停地翻看X盘(由boot.wim虚拟出来的内存盘),列出b开头的可执行程序(dir b*.exe /a),
在X:\Windows\System32>我找到一个bootrec.exe,似乎跟bootsect/bcdedit不大一样,
执行了一下,提示
X:\Windows\System32>bootrec /?
Repairs critical disk structures. The following commands are supported:
/FixMbr — writes the master boot record of the system partition using the master boot record compatible with Windows Vista. This operation does not overwrite the existing partition table.
/FixBoot — write a new boot sector onto the system partition using the boot sector compatible with Windows Vista.
/ScanOs — scan all disks for installations compatible with Windows Vista and display the entries that are currently not in the boot configuration store.
/RebuildBcd — scan all disks for installations compatible with Windows Vista and allow the user to choose which to add to the boot configuration store.
看到这些,让我想起了XP/2K3的Recovery Console里面的fixmbr/fixboot,
也就是说,如果我执行bootrec /fixmbr的话,BootMgr的MBR代码就得以恢复了。
X:\Windows\System32>bootrec /fixmbr
执行后重启,GRUB已经被干掉,直接由BootMgr带头启动了。
现在引导流程变更为
1. BootMgr (Win2k8/Earlier Win) -> NTLDR (Win2k3/XP) -> GRUB (Ubuntu/Win2k8)
2. BootMgr (Win2k8/Earlier Win) -> [GRUB -> BootMgr] / [NTLDR]
关键词汇:
[Windows 2008] [Win2k8] [Win2008] [Windows Server 2008] [Ubuntu] [WinXP] [Windows XP] [Win2k3] [Windows 2003] [Win2003] [BootMgr] [MBR] [GRUB] [Leopard] [NTLDR] [Linux] [BootRec] [BootSect] [BCDEdit] [Boot] [多重启动]