[讨论]双硬盘独立ubuntu及win双系统引导方法

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
jalousie
帖子: 7
注册时间: 2008-04-14 16:22

[讨论]双硬盘独立ubuntu及win双系统引导方法

#1

帖子 jalousie » 2009-04-28 18:53

我的电脑上2块硬盘,单独挂一块硬盘来用互不相影响,现hd0为master,有ubuntu的为slave,可以在bios里改启动顺序:
hd0,
0 ntfs 主分区活动 安装 server 2008
4 ntfs 逻辑
5 ntfs 逻辑
hd1,
0 ext4 主分区活动 安装 ubuntu 9.04
4 ntfs 逻辑
c盘采用win 7的bootmgr(引导vhd文件里的win 7),使用boot.ini文件引导grub4dos如下:

代码: 全选

[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"
这里,ubuntu文件来源如下,并还有一种引导方式,上面的boot.ini加第一步为一种,下面2步为一种:
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
grub在d盘(放c盘更简单,我d盘还有几个PE,我是为了省事,官方的grub文件自动搜索路径会先找到d盘的menu.lst),d:\boot\grub\menu.lst文件如下:

代码: 全选

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
这里,我的电脑先从hd0引导,我可以进入grub,然后使用上面第5项引导转入ubuntu的menu.lst并引导ubuntu,这时,由于gnu grub不能识别ntfs分区,所以不能使用find自适应win的位置,但能用上面第9项命令转回第一块硬盘,
如此也就实现了
  • 1. 两块硬盘单独用任一块都与单独安装一个系统一样
    2. 不管是先从哪块硬盘启动,都能在两者之间跳转
不知有没有办法在gnu grub下使用find自动查找/bootmgr等,或实现类似功能?
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: [讨论]双硬盘独立ubuntu及win双系统引导方法

#2

帖子 billbear » 2009-04-28 21:32

没有办法,但是你可以在 gnu grub 下装入 grub4dos。

title grub4dos
kernel (hd?,?)/?/?/..../grub.exe
回复