个人工具

UbuntuHelp:How to dual-boot Ubuntu and XP after installing them separately on two HDs

来自Ubuntu中文

Wikibot讨论 | 贡献2007年11月22日 (四) 13:02的版本 (新页面: {{From|https://help.ubuntu.com/community/How_to_dual-boot_Ubuntu_and_XP_after_installing_them_separately_on_two_HDs}} {{Languages|UbuntuHelp:How_to_dual-boot_Ubuntu_and_XP_after_installin...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索


Introduction

You have installed Ubuntu on a separate HD because you were afraid to loose things on your Windows disk? You absolutely want to keep XP and Ubuntu separate? Then this might help you. :)

Case 1: You haven't installed Ubuntu yet

Do a fresh install of Ubuntu with the windows hard drive still plugged in. Ubuntu will automatically detect the other hard drive, and Grub will automatically list it as a choice at startup. You can then also see the other hard drive and access it while in Ubuntu by mounting it.

Case 2: You already installed Ubuntu on an HD

Short tutorial

If you were afraid to partition and format another hard drive just for Ubuntu and disconnected the previous one with Windows during the installation, you will run into this problem to have to add Windows boot manually. The solution is simply adding this to /boot/grub/menu.lst:

title		Windows XP Professional
root		(hd1,0)
savedefault
makeactive
chainloader	+1
map (hd0) (hd1)
map (hd1) (hd0)

The parts with (hd1,0),(hd0) (hd1) and (hd1) (hd0) depend on where your Windows partition is, which you can find out by typing:

sudo fdisk -l

In this example, Windows is assumed to be on hd1 and Ubuntu on hd0.

The problem is that Windows boot must be on the first hard disk/partition in order to boot. You trick it into thinking that by adding those last two lines with the map command in the Grub menu entry.

Complete tutorial

Backup your menu.lst first:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.bkp

Find out where your Windows hard disk is with (if you are confused here just post the result here and someone might help)

sudo fdisk -l

Then you need to add the new entry to grub with

sudo gedit /boot/grub/menu.lst

And then add the entry:

title		Windows XP Professional
root		(hd1,0)
savedefault
makeactive
chainloader	+1
map (hd0) (hd1)
map (hd1) (hd0)

If your Windows is on a second SATA you have to use sd1 instead of hd1, I think. The second line of the map command is just so your Ubuntu hard drive will be recognizeable on Windows. If you need to read/write on Ubuntu partitions from Windows or vice-versa, you need to search for other tools (ntfs-3g and ntfs-config for Ubuntu and ext3 for Windows), but that's outside the scope of this thread.

If you need more information on Grub's map command you can find it here.

References

Go back