当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [转帖]How to dual boot Linux and Windows XP
帖子发表于 : 2007-10-23 0:50 
头像

注册: 2006-08-16 1:57
帖子: 75
地址: 上海
送出感谢: 0 次
接收感谢: 0 次
How to dual boot Linux and
Windows XP (Linux installed first)
29th May 2007

James Bannan


Linux , Windows


UPDATED 29 May 2007 ­ now uses Ubuntu 7.04 as the Linux distribution rather than Ubuntu 6.10.
Scenario: You want to install XP on your machine alongside your existing Linux installation, on the same
drive. You have installed Ubuntu already. (If you have already have XP installed, check out our tutorial on
how to dual­boot Linux with XP, with XP installed first .)
Tutorial Summary: We're going to use the Gnome Partition Editor (Gparted) from the Ubuntu LiveCD
to shrink the main Ubuntu data partition on the hard disk and create enough space for an installation of
XP.
We'll then install XP, and, because XP overwrites the master boot record, we'll restore the GRUB boot
loader so that either XP or Linux can be selected at boot time.
This is an updated tutorial from our previous Linux/XP workshop. That version was written using Ubuntu
6.10, whereas this tutorial was written for Ubuntu 7.04.
These steps have been tested in both an ASUS P5AD2­based system with an 80GB Seagate SATA drive
and a VMWare 6 virtual machine.
Prepare the Ubuntu System
The assumption is that the Ubuntu system has been installed on a single hard drive which has enough
space to accommodate both operating systems.
The first step is to create enough space on the disk to install Windows XP. The Ubuntu Live CD does
contains GNOME Partition Editor, which can be used to resize Linux partitions, but the Live CD for
Ubuntu 7.04 has an annoying tendency to mount the filesystem while it's checking it. This causes an
partition work to bring up an error. It does work, but it's messy. So instead we'll use the GParted LiveCD,
which acts independently of the OS and doesn't give us any grief.
The GParted LiveCD ISO is available here – burn it to CD and boot the system from the disc. The version
we used was 0.3.4­7.
Boot the Ubuntu machine from the GParted LiveCD. Depending on your system, you should just need to
select the auto­configuration boot option.

During boot, press Enter twice when prompted to select the keymap and language settings. When the
main GUI loads, right­click on the main partition (depending on your setup, probably /dev/sda1) and
select Resize/Move.

Use the slider to create sufficient space to house the XP installation then click Resize/Move.

Once that's done, quit GParted and reboot the machine from the Windows XP CD.

Now, install Windows XP
Once the CD has loaded, press Enter to install Windows XP, then F8 to accept the license agreement.
When the partition screen loads, you can see that Windows Setup can see the two existing Ubuntu
partitions and has interestingly assigned them drive letters (even though it can't read them.)
The space we’ve just created is also there, so select that and hit Enter.

Windows XP ­ Select Partition

Because the primary active partition (/dev/hda1) has been marked as bootable, Windows can’t be installed
until this partition has been marked inactive so that the new partition can take over. This is pretty much
the same as installing Windows Vista. Hit Enter to make this change and then format the new partition.
Windows XP ­ Mark Partition Active

Unfortunately because XP detected the two Ubuntu partitions and assigned them drive letters, the new
partition which Windows is going to be installed on will be assigned drive letter F:, which is definitely a
non­standard drive letter for Windows.
However, it’s not that much of a problem – at least as far as Windows and therefore most other intelligent
applications go.
It could be a problem for older apps which don’t look to the Windows settings and make assumptions
about where they can install themselves (for example, apps that are hard coded to install to Drive C).
Reboot the system once Windows is installed and you’ll see that it boots straight into XP. Ubuntu’s GRUB
bootloader in the MBR (Master Boot Record) has been overwritten, so Ubuntu isn’t bootable at this point
in time.
There are ways to make the Ubuntu partition bootable while still using XP’s bootloader in the MBR.
However this is fiddly and involves using FAT32 partitions, as FAT32 is readable by both XP and Ubuntu.
Wherever possible I avoid using FAT32 – it’s nowhere near as optimised as NTFS, and you lose out on all
the enhanced security and permissions features.
Reinstating GRUB as the system bootloader is a much better alternative – it handles pretty much any
operating system you care to throw at it, and it’s very easy to administer.
Reinstall GRUB to the MBR
The next step is to reinstate GRUB as the system bootloader. Boot the system using the Ubuntu Live CD.
Go into the GNOME Partition Editor and you can see that the Windows XP Partition is detected as
/dev/hda2 and has been marked as the boot partition.
It can actually stay as the boot partition, but as we’re going to reinstall GRUB it makes sense to change
this – it doesn’t adversely effect XP.
Right­click the Windows partition and select Manage Flags.
Untick “boot” and select Close.
Then right­click the primary Ubuntu partition (/dev/hda1), select Manage Flags and tick “boot”, then
Close. Done.

GParted ­ Manage Flags
GParted ­ Mark Bootable

Now to reinstall GRUB. Open up Terminal (Applications, Accessories, Terminal) and type in:
sudo grub

This will launch the GRUB application. Now type in:
find /boot/grub/stage1

This will search for where GRUB has been installed, and you should get the result hd(0,0).
Change the active root to this location by typing in:
root (hd0,0)

Now we’re going to reinstall GRUB to the MBR rather than the Ubuntu partition.
If we were going to use the Windows XP bootloader then we’d reinstall GRUB to hd(0,0), but as we’re
not, type in:
setup (hd0)
This restores GRUB to the MBR. Type in QUIT and then EXIT to get out of GRUB and Terminal
respectively, then reboot the system. Ubuntu will load by default.

Modify the Boot Menu
What we need to do now is modify the GRUB boot menu to allow Windows XP to load. Boot the system
into Ubuntu and go to Terminal. Type in:
sudo gedit /boot/grub/menu.lst

This loads the GRUB menu file (which is basically a text file) within GEdit.
Navigate down to the section which after “## ## End Default Options ##".
These are the individual menu items in the GRUB menu.
Ubuntu & XP ­ GRUB Menu

To create a new entry, navigate down to the end of the list (although it can go anywhere really) and enter
the following lines:
title Windows XP
root (hd0,1)
makeactivechainloader +1

This places an item in the boot menu to launch Windows XP from its own partition (hd0,1).
If you like, scroll up to the top of MENU.LST and find the line called TIMEOUT.
The numerical value assigned to TIMEOUT dictates how long you’ve got to go into the boot menu (in
seconds) before the default boot item loads.
When configuring a dual­/multi­boot system I find it better to increase this value.


Just above TIMEOUT is DEF AULT. This specifies which boot entry is the default.
The numbering system starts at 0 and counts upwards, so the DEFAULT = 0 means that Ubuntu is always
the default entry.
If you want Windows XP to be the default, replace the value.

Save MENU.LST and exit from GEdit, then restart the system.
Hit ESC when prompted to bring up the boot menu, and there’s the newly­created Windows XP entry.
Navigate to this boot item and hit Enter – Windows XP will load.
Uninstalling Windows XP
If you decide after a while that this dualbooting situation is no good and you wish to scrap Windows XP,
it’s actually very easy.
Go through the process outlined above to modify the MENU.LST and remove the Windows boot entry.
Then boot off the Ubuntu Live CD and go into GNOME Partition Editor. Right­click the Windows
partition (/dev/hda2) and select Delete.
Then right­click the main Ubuntu partition (/dev/hda1) and select Resize/Move.
Drag the edge of the partition to reclaim the space you’ve just freed up by deleting the Windows XP
partition and click Resize.
There will now be two actions waiting in the Operations window. Hit Apply and these changes are made.
This take your system right back to the start before Windows was installed, and is actually quite a
graceful exit from the dualboot scenario.
Other APC dual­booting tutorials:

The definitive dual­booting guide: Linux, Vista and XP step­by­step

[/u][/quote][/code][/url]


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2007-10-23 6:11 

注册: 2007-08-09 3:33
帖子: 1488
系统: Windows 12.04
送出感谢: 2
接收感谢: 1
既然先装了Linux,还要XP干什么,嘿嘿嘿。(开个玩笑)

其实先Linux后XP,唯一需要注意的问题就是Grub的恢复,别的都一样。


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译