c盘采用win 7的bootmgr(引导vhd文件里的win 7),使用boot.ini文件引导grub4dos如下:hd0,
0 ntfs 主分区活动 安装 server 2008
4 ntfs 逻辑
5 ntfs 逻辑
hd1,
0 ext4 主分区活动 安装 ubuntu 9.04
4 ntfs 逻辑
代码: 全选
[boot loader]
timeout=3
default=multi(0)disk(0)rdisk(0)partition(1)\Windows
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\Windows="Microsoft Windows XP Professional" /fastdetect
C:\grldr.mbr="My Grub4Dos"
C:\ubuntu="Ubuntu"
grub在d盘(放c盘更简单,我d盘还有几个PE,我是为了省事,官方的grub文件自动搜索路径会先找到d盘的menu.lst),d:\boot\grub\menu.lst文件如下:1.导出Linux引导记录(Grub没有安装在MBR)
#sudo dd if=/dev/sda1 of=/home/用户名/ubuntu bs=512 count=1
/dev/sda1为ubuntu boot所在分区,of=后为文件输出路径。
生成ubuntu,将此文件放在c盘。
2.在Vista的引导菜单中加入Ubuntu引导
在Vista下,用管理员权限运行cmd,
然后
bcdedit /create /d "Ubuntu" /application bootsector
得到了一个id字符串
bcdedit /set {id} device partition=C:
bcdedit /set {id} path \ubuntu
bcdedit /displayorder {id} /addlast
代码: 全选
fontfile /boot/grub/font.gz
splashimage /boot/grub/bg.xpm.gz
timeout 10
default 0
title 1. 引导 WinPE 2.1 (Vista sp1)
find --set-root --ignore-floppies --ignore-cd /sources/boot.wim
chainloader /bootmgr
title 2. 引导 WinPE-2003 (hhh333)
map (hd0,4)+1 (hd0)
map --hook
find --set-root --ignore-floppies --ignore-cd /minipe/winpe03.is_
chainloader /boot/setupl03.bin
title 3. 引导 WinPE-XP (hhh333)
map (hd0,4)+1 (hd0)
map --hook
find --set-root --ignore-floppies --ignore-cd /minipe/winpe.is_
chainloader /boot/setupldr.bin
title 4. 引导 一键还原精灵个人版
find --set-root --ignore-floppies --ignore-cd /yjhy/grub/menu.lst
configfile /yjhy/grub/menu.lst
title 5. 引导 Ubuntu
find --set-root --ignore-floppies --ignore-cd /boot/grub/stage1
configfile /boot/grub/menu.lst
title 6. 引导 NT/2000/XP/2003
find --set-root /ntldr
chainloader /ntldr
title 7. 引导 Vista/2008/win 7
find --set-root /bootmgr
chainloader /bootmgr
title 8. 引导 第一个光驱上的系统 (cd0)
cdrom --init
map --hook
chainloader (cd0)
title 9. 引导 第一块硬盘上的系统 (hd0,0)
root (hd0,0)
chainloader +1
title 10. 转到 Grub 命令行
commandline
title 11. 重新启动计算机
reboot
title 12. 关机
halt
如此也就实现了
- 1. 两块硬盘单独用任一块都与单独安装一个系统一样
2. 不管是先从哪块硬盘启动,都能在两者之间跳转