个人工具

“UbuntuHelp:WindowsDualBoot”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:WindowsDualBoot}}
 
{{Languages|UbuntuHelp:WindowsDualBoot}}
 
#title Dual Boot Ubuntu and Windows
 
#title Dual Boot Ubuntu and Windows
If Windows isn't already installed, install it first. If you leave space for Ubuntu at this step you don't have to resize your NTFS partition later saving a bit of time.
+
== Introduction ==
=== Back up your existing PC ===
+
This page describes how to easily set up your computer to dual boot Ubuntu and Windows.
While the Ubuntu installer is very safe and can reliably partition your hard disk to allow you to dual boot, it may be a good idea to be ensure that you are able to restore your Windows installation before you try to install Ubuntu.
+
== Installing Ubuntu after Windows ==
==== Backing up your data ====
+
It is much easier to install Windows and then Ubuntu, so if Windows isn't already installed, install it first. If you leave space for Ubuntu at this step you don't have to resize your NTFS partition later saving a bit of time.
Although this may seem obvious, do backup your important data files to another media before attempting a dual-boot install. Many backup solutions exist for Windows users, but the easiest one may be to just create as many CDs or DVDs with copies of your data as required. Another way is by plugging in a USB key or external storage with enough space.
+
=== Backing Up Your Data And Operating System ===
==== Backing up your operating system - using recovery tools ====
+
Although this may seem obvious, do backup your important data files to another media before attempting a dual boot install. Many backup solutions exist for Windows users, but the easiest one may be to just plug in a USB flash drive or other external storage with enough space on it, or create as many CDs or DVDs with copies of your data as required. (Maybe you can borrow a USB hard drive from a friend if you don't have one.)
''Have your recovery CD or DVD handy'' - Most systems which are delivered with Windows already installed also come with some sort of recovery or re-installation disk. There is a recent tendency for companies to try to save money and not ship such a disk.  Instead, they provide you a hidden partition on which there is a recovery tool and an image of the pre-installed system.
+
''Have your recovery CD or DVD handy'' - Most systems which are delivered with Windows already installed also come with some sort of recovery or re-installation disk. There is a recent tendency for companies to try to save money and not ship such a disk.  Instead, they provide you a hidden partition on which there is a recovery tool and an image of the pre-installed system.
If you are buying a new computer and intend on dual-booting, perhaps it would be a good idea to inquire if you can get a Windows install or recovery media (CD or DVD), if one is not provided by default. The only solution is to telephone your vendor and ask for a proper CD or DVD, which you are normally entitled to.
+
If you are buying a new computer and intend on dual booting, perhaps it would be a good idea to inquire if you can get a Windows install or recovery media (CD or DVD), if one is not provided by default. The only solution is to telephone your vendor and ask for a proper CD or DVD, which you are normally entitled to.
 
There is no mention in the Windows End User License Agreement (EULA) of the partitioning of the hard drive(s) being against it.  Just because the tool they provide for system restore is not adequate does not mean you are prohibited from using another tool.
 
There is no mention in the Windows End User License Agreement (EULA) of the partitioning of the hard drive(s) being against it.  Just because the tool they provide for system restore is not adequate does not mean you are prohibited from using another tool.
According to the Windows EULA, you are entitled to a backup copy of your OS.  While your vendor is not really obliged to provide you with one, having such image tools pre-installed on your computer in no way prohibits you from obtaining a proper backup of your installation cd.  You can remove the restore-image tools from your computer at any time, although Ubuntu can happily be installed alongside them and keep them intact.  
+
According to the Windows EULA, you are entitled to a backup copy of your OS.  While your vendor is not really obliged to provide you with one, having such image tools pre-installed on your computer in no way prohibits you from obtaining a proper backup of your installation CD.  You can remove the restore-image tools from your computer at any time, although Ubuntu can happily be installed alongside them and keep them intact.
 
The problem with that is if your partition table becomes corrupt, or if you have hardware problem with your disk, recovery from an internal partition is not an option.
 
The problem with that is if your partition table becomes corrupt, or if you have hardware problem with your disk, recovery from an internal partition is not an option.
''Example request for Windows OS CD / DVD recovery media''
+
''Example request for Windows OS CD / DVD recovery media:''
You:
+
 
"I am about to install Ubuntu Linux and that will change my partition table.  I was not given an OS install disk with my system, but a system restore program which is on a hidden partition.  If, for some reason, the PC restore tool is no longer able to find the image partition, I would not be able to restore my system.  The system restore tools that came with my system are not adequate for my needs.  I need an operating system disk.  Would you send me one?"
 
"I am about to install Ubuntu Linux and that will change my partition table.  I was not given an OS install disk with my system, but a system restore program which is on a hidden partition.  If, for some reason, the PC restore tool is no longer able to find the image partition, I would not be able to restore my system.  The system restore tools that came with my system are not adequate for my needs.  I need an operating system disk.  Would you send me one?"
PC manufacturer rep:
+
==== Getting Recovery Media ====
"Sure, we'll send one out to you.  It should take two or three days for you to receive it."
+
==== Getting recovery media - contact information  ====
+
 
* [http://support.dell.com/support/topics/global.aspx/support/dsn/en/document?c=us&cs=19&docid=287034&l=en&s=dhs&redirect=1#7 Dell Operating System (OS) Recovery CD Creation and Manual Operating System Reinstall]
 
* [http://support.dell.com/support/topics/global.aspx/support/dsn/en/document?c=us&cs=19&docid=287034&l=en&s=dhs&redirect=1#7 Dell Operating System (OS) Recovery CD Creation and Manual Operating System Reinstall]
 
* [http://support.dell.com/pcrt Other related links and information for Dell owners]
 
* [http://support.dell.com/pcrt Other related links and information for Dell owners]
* [http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-4M7HWZ How can I get a Product Recovery CD or DVD ?]  - for Lenovo owners
+
* [http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-4M7HWZ How can I get a Product Recovery CD or DVD?]  - for Lenovo owners
* [http://www.mydigitallife.info/2006/01/18/ibm-lenovo-thinkpad-recovery-cd/ Someone's experience getting recovery CDs from IBM for a Thinkpad]  
+
* [http://www.mydigitallife.info/2006/01/18/ibm-lenovo-thinkpad-recovery-cd/ Someone's experience getting recovery CDs from IBM for a Thinkpad]
 
* [http://h10025.www1.hp.com/ewfrf/wc/genericDocument?cc=us&docname=bph07143&lc=en Obtaining a Windows Recovery CD or DVD set] - for HP and Compaq Desktop PCs owners
 
* [http://h10025.www1.hp.com/ewfrf/wc/genericDocument?cc=us&docname=bph07143&lc=en Obtaining a Windows Recovery CD or DVD set] - for HP and Compaq Desktop PCs owners
 
=== Beginning Ubuntu Installation ===
 
=== Beginning Ubuntu Installation ===
第33行: 第30行:
 
<ol><li>Once you have the CD, insert it into your CD-ROM drive and reboot your PC.</li></ol>
 
<ol><li>Once you have the CD, insert it into your CD-ROM drive and reboot your PC.</li></ol>
  
* If the computer does not boot from the CD (eg. Windows starts again instead), check your BIOS settings and fix as appropriate.  
+
* If the computer does not boot from the CD (eg. Windows starts again instead), check your BIOS settings and fix as appropriate.
 
<ol><li>If successfully booted from CD, the Ubuntu logo will be displayed on the screen. Press Enter to continue.
 
<ol><li>If successfully booted from CD, the Ubuntu logo will be displayed on the screen. Press Enter to continue.
 
</li><li>Follow the prompts until you are asked this question: "How do you want to partition the disk ?".</li></ol>
 
</li><li>Follow the prompts until you are asked this question: "How do you want to partition the disk ?".</li></ol>
第62行: 第59行:
 
</li><li>On reboot, remove your Ubuntu cdrom from the cdrom drive, you should be presented with a list of operating systems to boot. Ubuntu should have automatically detected your Windows installation and added an option to boot it on this screen.</li></ol>
 
</li><li>On reboot, remove your Ubuntu cdrom from the cdrom drive, you should be presented with a list of operating systems to boot. Ubuntu should have automatically detected your Windows installation and added an option to boot it on this screen.</li></ol>
  
=== Master boot record and boot manager ===
+
=== Disadvantage of Installing Ubuntu after Windows ===
 +
This is an optional tip for advanced users to make Ubuntu faster. The rotating hard drive does not have the same performance over all cylinders. The speed of the disk relative to the head is larger at the disk outer edge than near the center of the disk. Therefore rotating disks may have read/write rate 60 MB/sec at the cylinders  with lowest numbers (near the outer edge), but only 30-40 MB/sec at cylinders with highest numbers (near the center). So if you just shrink Windows partition and then install Ubuntu, you end up with Windows on the fast side the disk and Ubuntu on the slow side. For faster Ubuntu, install Ubuntu first, and then install Windows. Note that sometimes Windows refuses to be installed anywhere but in the disk partition 1. In such a case, during Ubuntu installation, create your Ubuntu partitions 2,3, and perhaps 4 at low numbered cylinders, and leave unused partition 1 and some amount of high numbered cylinders for Windows. During Windows installation, Windows will set up partition 1 in the slow high numbered cylinders.
 +
== Master Boot Record and Boot Manager ==
 
GNU/GRUB is the boot manager installed in Ubuntu by default. If you use the Alternate CD you can choose Lilo instead. GRUB and Lilo are both good Open Source boot managers so the main parts of the boot loaders are installed inside Ubuntu. This means Ubuntu is independant and avoids any need for writing to other operating systems. To accomplish this, the only thing in your computer outside of Ubuntu that needs to be changed is a small code in the MBR (Master Boot Record) of the first hard disk. The MBR code is changed to point to the boot loader in Ubuntu. You will be presented with a list of operating systems and you can choose one to boot. If you do nothing Ubuntu will boot after a ten second countdown. If you select Windows then GRUB or Lilo will chainload Windows for you at the Windows boot sector, which is the first sector of the Windows partition.
 
GNU/GRUB is the boot manager installed in Ubuntu by default. If you use the Alternate CD you can choose Lilo instead. GRUB and Lilo are both good Open Source boot managers so the main parts of the boot loaders are installed inside Ubuntu. This means Ubuntu is independant and avoids any need for writing to other operating systems. To accomplish this, the only thing in your computer outside of Ubuntu that needs to be changed is a small code in the MBR (Master Boot Record) of the first hard disk. The MBR code is changed to point to the boot loader in Ubuntu. You will be presented with a list of operating systems and you can choose one to boot. If you do nothing Ubuntu will boot after a ten second countdown. If you select Windows then GRUB or Lilo will chainload Windows for you at the Windows boot sector, which is the first sector of the Windows partition.
That is the least intrusive way to install Ubuntu.
 
 
If you have a problem with changing the MBR code, you might prefer to just install the code for pointing to GRUB to the first sector of your Ubuntu partition instead. If you do that during the Ubuntu installation process, then Ubuntu won't boot until you configure some other boot manager to point to Ubuntu's boot sector.
 
If you have a problem with changing the MBR code, you might prefer to just install the code for pointing to GRUB to the first sector of your Ubuntu partition instead. If you do that during the Ubuntu installation process, then Ubuntu won't boot until you configure some other boot manager to point to Ubuntu's boot sector.
 
Windows Vista no longer utilizes boot.ini, ntdetect.com, and ntldr when booting. Instead, Vista stores all data for its new boot manager in a boot folder. Windows Vista ships with an command line utility called bcdedit.exe, which requires administrator credentials to use. You may want to read [http://go.microsoft.com/fwlink/?LinkId=112156] about it.
 
Windows Vista no longer utilizes boot.ini, ntdetect.com, and ntldr when booting. Instead, Vista stores all data for its new boot manager in a boot folder. Windows Vista ships with an command line utility called bcdedit.exe, which requires administrator credentials to use. You may want to read [http://go.microsoft.com/fwlink/?LinkId=112156] about it.
Using a command line utility always has its learning curve, so a more productive and better job can be done with a free utility called [http://neosmart.net/dl.php?id=1 EasyBCD], developed and mastered in during the times of Vista Beta already.
+
Using a command line utility always has its learning curve, so a more productive and better job can be done with a free utility called [http://neosmart.net/dl.php?id=1 EasyBCD], developed and mastered in during the times of Vista Beta already. EasyBCD is user friendly and many Vista users highly recommend EasyBCD.
EasyBCD is user friendly and many Vista users highly recommend EasyBCD.
+
== Installing Windows After Ubuntu ==
=== Installing windows after ubuntu ===
+
Normally when Windows is installed after Ubuntu the master boot record will be overwritten. This means that you would have to boot off a [[UbuntuHelp:LiveCD|LiveCD]] and re-install grub. However, here is an alternative method:
When windows is installed it will overwrite the master boot record. This means normally you would have to boot off a livecd and re-install grub. Here is an alternative method.
+
 
<ol><li>Create an NTFS partition for windows (using fdisk or whatever tool you are familiar with)
 
<ol><li>Create an NTFS partition for windows (using fdisk or whatever tool you are familiar with)
</li><li>Backup the boot sector with eg. dd if=/dev/hda of=/mbr.bin bs=512 count=1
+
</li><li>Backup the boot sector e.g. <code><nowiki>dd if=/dev/hda of=/mbr.bin bs=512 count=1</nowiki></code>
 
</li><li>Install windows
 
</li><li>Install windows
</li><li>Boot into a livecd
+
</li><li>Boot into a [[UbuntuHelp:LiveCD|LiveCD]]
</li><li>Mount your root partition in the livecd
+
</li><li>Mount your root partition in the [[UbuntuHelp:LiveCD|LiveCD]]
</li><li>Restore the boot sector eg. dd if=/media/hda/mbr.bin of=/dev/hda bs=512 count=1
+
</li><li>Restore the boot sector e.g. <code><nowiki>dd if=/media/hda/mbr.bin of=/dev/hda bs=512 count=1</nowiki></code>
</li><li>Restart and linux will boot as before
+
</li><li>Restart and Ubuntu will boot
 
</li><li>Setup grub to boot windows</li></ol>
 
</li><li>Setup grub to boot windows</li></ol>
  
=== Issues with Windows XP and NTFS  ===
+
== Recovering GRUB after reinstalling Windows  ==
The Ubuntu installer has included support for resizing NTFS partitions since Ubuntu Breezy Badger 5.10 was released way back in 2005. Very few problems have been reported for the number of uses. If you tried the above procedure and have had no luck, it might be that there is a pre-existing problem in either in the file system or in the partition table or hard disk.
+
As above, when Windows is reinstalled, the master boot record will be overwritten. This can be avoided by backing up the boot sector, by following the instructions from step 2 in the above section 'Installing Windows After Ubuntu'. An alternative method, which has the advantage of not requiring forward planning, is to use the Ubuntu [[UbuntuHelp:LiveCD|LiveCD]] to reinstall the GRUB boot sector, here are step-by-step instructions, to be run after Windows has been reinstalled:
You should first try running CHKDSK before trying again to resize the partition, and if you are using the Alternate CD, defragging might help.
+
<ol><li>Boot into a [[UbuntuHelp:LiveCD|LiveCD]]
It is recommended that you run CHKDSK once again after resizing your NTFS partition.
+
</li><li>Open a terminal
 +
</li><li>Open the GRUB Command line utility by typing</li></ol>
 +
 
 +
<pre><nowiki>
 +
sudo grub
 +
</nowiki></pre>
 +
1.#4 Tell GRUB where your Ubuntu partition is by entering
 +
<pre><nowiki>
 +
root (hdA,B)
 +
</nowiki></pre>
 +
Where 'A' is the hard-drive number, starting at 0, and 'B' is the partition number, starting at 0. For example, if Ubuntu was installed on the second partition of the first hard-drive, the command should be
 +
<pre><nowiki>
 +
root (hd0,1)
 +
</nowiki></pre>
 +
1.#5 Tell GRUB which drive to put the boot sector on
 +
<pre><nowiki>
 +
setup (hd0)
 +
</nowiki></pre>
 +
(replacing 0, as above, if a drive other than the first is used as the boot device)
 +
1.#6 Leave the GRUB Command line
 +
<pre><nowiki>
 +
quit
 +
</nowiki></pre>
 +
and reboot.
 +
== Issues with Windows XP and NTFS  ==
 +
The Ubuntu installer has included support for resizing NTFS partitions since Ubuntu 5.10 (Breezy Badger) was released way back in 2005. Very few problems have been reported relative to the huge number of times that the installer has been used. If you tried the above procedure and have had no luck, it might be that there is a pre-existing problem either in the file system, in the partition table or the hard disk.
 +
First you should try running CHKDSK before trying again to resize the partition, and if you are using the Alternate CD, defragging might help. It is recommended that you run CHKDSK once again after resizing your NTFS partition.
 
Also, try the following alternative methods:
 
Also, try the following alternative methods:
==== Using QtParted from the System Rescue CD ====
+
=== Using QtParted from the System Rescue CD ===
 
<ol><li>Boot into Windows and backup any valuable documents/photos etc onto removable media such as CD-R/DVD-R.
 
<ol><li>Boot into Windows and backup any valuable documents/photos etc onto removable media such as CD-R/DVD-R.
 
</li><li>Run the Windows disk check tool (Error-checking) on C: a couple of times (the results can be seen in the Administrative Tools > Event Viewer > Application under a "Winlogon" entry).
 
</li><li>Run the Windows disk check tool (Error-checking) on C: a couple of times (the results can be seen in the Administrative Tools > Event Viewer > Application under a "Winlogon" entry).
第95行: 第118行:
  
 
<pre><nowiki>
 
<pre><nowiki>
run_qtparted  
+
run_qtparted
 
</nowiki></pre>
 
</nowiki></pre>
 
<ol><li>Select your disk on the graphical screen (most likely /dev/hda).
 
<ol><li>Select your disk on the graphical screen (most likely /dev/hda).
第105行: 第128行:
 
</li><li>Reboot and install Ubuntu into the free space.</li></ol>
 
</li><li>Reboot and install Ubuntu into the free space.</li></ol>
  
==== Using GParted from UNetbootin-PartedMagic ====
+
=== Using GParted from UNetbootin-PartedMagic ===
 
Another approach to resizing partitions, which does not require a CD, is to load [http://partedmagic.com/ PartedMagic] from Windows via the [http://sourceforge.net/project/showfiles.php?group_id=198821&package_id=240127 UNetbootin PartedMagic Loader]:
 
Another approach to resizing partitions, which does not require a CD, is to load [http://partedmagic.com/ PartedMagic] from Windows via the [http://sourceforge.net/project/showfiles.php?group_id=198821&package_id=240127 UNetbootin PartedMagic Loader]:
 
<ol><li>[http://sourceforge.net/project/showfiles.php?group_id=198821&package_id=240127 Download] and install the Windows (.exe) file, then reboot.
 
<ol><li>[http://sourceforge.net/project/showfiles.php?group_id=198821&package_id=240127 Download] and install the Windows (.exe) file, then reboot.
第116行: 第139行:
 
</li><li>Upon the next Windows boot, click OK when prompted to remove UNetbootin-partedmagic to remove its boot menu entry.</li></ol>
 
</li><li>Upon the next Windows boot, click OK when prompted to remove UNetbootin-partedmagic to remove its boot menu entry.</li></ol>
  
=== External howtos ===
+
== External Links ==
 
These are external links so that they're not 'officially' part of the "official" Ubuntu documentation; follow at your own risk.
 
These are external links so that they're not 'officially' part of the "official" Ubuntu documentation; follow at your own risk.
* [http://users.bigpond.net.au/hermanzone/ Illustrated Dual Boot Site].  
+
* [http://users.bigpond.net.au/hermanzone/ Illustrated Dual Boot Site].
 
* [http://neosmart.net/wiki/display/EBCD/Linux Dual-Booting Ubuntu and Vista with EasyBCD]
 
* [http://neosmart.net/wiki/display/EBCD/Linux Dual-Booting Ubuntu and Vista with EasyBCD]
 
* [http://neosmart.net/wiki/display/EBCD/Ubuntu Step-By-Step Screenshot Tutorial to set-up an Ubuntu + Vista dual-boot]
 
* [http://neosmart.net/wiki/display/EBCD/Ubuntu Step-By-Step Screenshot Tutorial to set-up an Ubuntu + Vista dual-boot]
* [[http://www.ehomeupgrade.com/entry/2622/how-to_dual-boot_ubuntu|How-To: Dual-Boot Ubuntu 6.06 (Dapper) Linux Desktop Along  
+
* [http://www.ehomeupgrade.com/entry/2622/how-to_dual-boot_ubuntu How-To: Dual-Boot Ubuntu 6.06 (Dapper) Linux Desktop Along Side Windows XP].
* [http://militarylinux.blogspot.com/2008/10/dual-boot.html]
+
Side Windows XP]].  
+
 
* [http://www.howtoforge.com/unetbootin_windows_ubuntu_fedora_p4 HowtoForge Guide: Partition Resizing using UNetbootin-PartedMagic]
 
* [http://www.howtoforge.com/unetbootin_windows_ubuntu_fedora_p4 HowtoForge Guide: Partition Resizing using UNetbootin-PartedMagic]
 
----
 
----

2009年5月12日 (二) 19:47的版本

  1. title Dual Boot Ubuntu and Windows

Introduction

This page describes how to easily set up your computer to dual boot Ubuntu and Windows.

Installing Ubuntu after Windows

It is much easier to install Windows and then Ubuntu, so if Windows isn't already installed, install it first. If you leave space for Ubuntu at this step you don't have to resize your NTFS partition later saving a bit of time.

Backing Up Your Data And Operating System

Although this may seem obvious, do backup your important data files to another media before attempting a dual boot install. Many backup solutions exist for Windows users, but the easiest one may be to just plug in a USB flash drive or other external storage with enough space on it, or create as many CDs or DVDs with copies of your data as required. (Maybe you can borrow a USB hard drive from a friend if you don't have one.) Have your recovery CD or DVD handy - Most systems which are delivered with Windows already installed also come with some sort of recovery or re-installation disk. There is a recent tendency for companies to try to save money and not ship such a disk. Instead, they provide you a hidden partition on which there is a recovery tool and an image of the pre-installed system. If you are buying a new computer and intend on dual booting, perhaps it would be a good idea to inquire if you can get a Windows install or recovery media (CD or DVD), if one is not provided by default. The only solution is to telephone your vendor and ask for a proper CD or DVD, which you are normally entitled to. There is no mention in the Windows End User License Agreement (EULA) of the partitioning of the hard drive(s) being against it. Just because the tool they provide for system restore is not adequate does not mean you are prohibited from using another tool. According to the Windows EULA, you are entitled to a backup copy of your OS. While your vendor is not really obliged to provide you with one, having such image tools pre-installed on your computer in no way prohibits you from obtaining a proper backup of your installation CD. You can remove the restore-image tools from your computer at any time, although Ubuntu can happily be installed alongside them and keep them intact. The problem with that is if your partition table becomes corrupt, or if you have hardware problem with your disk, recovery from an internal partition is not an option. Example request for Windows OS CD / DVD recovery media: "I am about to install Ubuntu Linux and that will change my partition table. I was not given an OS install disk with my system, but a system restore program which is on a hidden partition. If, for some reason, the PC restore tool is no longer able to find the image partition, I would not be able to restore my system. The system restore tools that came with my system are not adequate for my needs. I need an operating system disk. Would you send me one?"

Getting Recovery Media

Beginning Ubuntu Installation

  1. Boot into Windows or using an Ubuntu Live CD and [[UbuntuHelp:[head-009b592d724f498a1433d410f28bdc042a486f05|backup]]] any valuable documents/photos etc. onto removable media such as CD-R/DVD-R.
  2. Run the Windows defragmentation tool on C: (My Computer, Right click on drive, Properties, Tools, Defragment Now)
  3. Download and burn, or order a CD
  1. Once you have the CD, insert it into your CD-ROM drive and reboot your PC.
  • If the computer does not boot from the CD (eg. Windows starts again instead), check your BIOS settings and fix as appropriate.
  1. If successfully booted from CD, the Ubuntu logo will be displayed on the screen. Press Enter to continue.
  2. Follow the prompts until you are asked this question: "How do you want to partition the disk ?".

Resizing partitions with Windows Vista

Windows Vista can shrink its own partition without the need to use third-party software. See this link. If you are running Windows Vista, shrink down your partition through that method, and then boot Ubuntu. The Ubuntu installer will use the free space you created.

Resizing Partitions Using the Ubuntu Installer

Automatic partitioning

  1. Choose the First Option (It should be something like: "Resize IDE1 master, partition #1 (hda1) and use freed space").
  2. Specify the size of the new partition as a percentage of your entire hard disk.
  3. Click on "Forward".
  4. continue to Finishing|Ubuntu Installation

Manual partitioning

  1. Choose "Manually edit partition table"
  • Listed will be your current partitions
  1. Select the partition you want to resize and press Enter.
  2. Select "Size:", press Enter.
  3. Select Yes, press Enter.
  4. Type in a new size in Gigabytes for your partition, it's recommended you free up AT LEAST 10 GB of free space for your Ubuntu install. Press Enter when happy with your changes. It may take some time to apply the changes.
  5. Create a swap partition of at least your amount of RAM (if you don't know, 2000 MB is a good value).
  6. Create a partition for your Ubuntu installation, at least 10 GB.
  7. Select "Finish partitioning and write changes to disk".

Finishing Ubuntu Installation

  1. Finish installing your Ubuntu system.
  2. On reboot, remove your Ubuntu cdrom from the cdrom drive, you should be presented with a list of operating systems to boot. Ubuntu should have automatically detected your Windows installation and added an option to boot it on this screen.

Disadvantage of Installing Ubuntu after Windows

This is an optional tip for advanced users to make Ubuntu faster. The rotating hard drive does not have the same performance over all cylinders. The speed of the disk relative to the head is larger at the disk outer edge than near the center of the disk. Therefore rotating disks may have read/write rate 60 MB/sec at the cylinders with lowest numbers (near the outer edge), but only 30-40 MB/sec at cylinders with highest numbers (near the center). So if you just shrink Windows partition and then install Ubuntu, you end up with Windows on the fast side the disk and Ubuntu on the slow side. For faster Ubuntu, install Ubuntu first, and then install Windows. Note that sometimes Windows refuses to be installed anywhere but in the disk partition 1. In such a case, during Ubuntu installation, create your Ubuntu partitions 2,3, and perhaps 4 at low numbered cylinders, and leave unused partition 1 and some amount of high numbered cylinders for Windows. During Windows installation, Windows will set up partition 1 in the slow high numbered cylinders.

Master Boot Record and Boot Manager

GNU/GRUB is the boot manager installed in Ubuntu by default. If you use the Alternate CD you can choose Lilo instead. GRUB and Lilo are both good Open Source boot managers so the main parts of the boot loaders are installed inside Ubuntu. This means Ubuntu is independant and avoids any need for writing to other operating systems. To accomplish this, the only thing in your computer outside of Ubuntu that needs to be changed is a small code in the MBR (Master Boot Record) of the first hard disk. The MBR code is changed to point to the boot loader in Ubuntu. You will be presented with a list of operating systems and you can choose one to boot. If you do nothing Ubuntu will boot after a ten second countdown. If you select Windows then GRUB or Lilo will chainload Windows for you at the Windows boot sector, which is the first sector of the Windows partition. If you have a problem with changing the MBR code, you might prefer to just install the code for pointing to GRUB to the first sector of your Ubuntu partition instead. If you do that during the Ubuntu installation process, then Ubuntu won't boot until you configure some other boot manager to point to Ubuntu's boot sector. Windows Vista no longer utilizes boot.ini, ntdetect.com, and ntldr when booting. Instead, Vista stores all data for its new boot manager in a boot folder. Windows Vista ships with an command line utility called bcdedit.exe, which requires administrator credentials to use. You may want to read [1] about it. Using a command line utility always has its learning curve, so a more productive and better job can be done with a free utility called EasyBCD, developed and mastered in during the times of Vista Beta already. EasyBCD is user friendly and many Vista users highly recommend EasyBCD.

Installing Windows After Ubuntu

Normally when Windows is installed after Ubuntu the master boot record will be overwritten. This means that you would have to boot off a LiveCD and re-install grub. However, here is an alternative method:

  1. Create an NTFS partition for windows (using fdisk or whatever tool you are familiar with)
  2. Backup the boot sector e.g. dd if=/dev/hda of=/mbr.bin bs=512 count=1
  3. Install windows
  4. Boot into a LiveCD
  5. Mount your root partition in the LiveCD
  6. Restore the boot sector e.g. dd if=/media/hda/mbr.bin of=/dev/hda bs=512 count=1
  7. Restart and Ubuntu will boot
  8. Setup grub to boot windows

Recovering GRUB after reinstalling Windows

As above, when Windows is reinstalled, the master boot record will be overwritten. This can be avoided by backing up the boot sector, by following the instructions from step 2 in the above section 'Installing Windows After Ubuntu'. An alternative method, which has the advantage of not requiring forward planning, is to use the Ubuntu LiveCD to reinstall the GRUB boot sector, here are step-by-step instructions, to be run after Windows has been reinstalled:

  1. Boot into a LiveCD
  2. Open a terminal
  3. Open the GRUB Command line utility by typing
sudo grub

1.#4 Tell GRUB where your Ubuntu partition is by entering

root (hdA,B)

Where 'A' is the hard-drive number, starting at 0, and 'B' is the partition number, starting at 0. For example, if Ubuntu was installed on the second partition of the first hard-drive, the command should be

root (hd0,1)

1.#5 Tell GRUB which drive to put the boot sector on

setup (hd0)

(replacing 0, as above, if a drive other than the first is used as the boot device) 1.#6 Leave the GRUB Command line

quit

and reboot.

Issues with Windows XP and NTFS

The Ubuntu installer has included support for resizing NTFS partitions since Ubuntu 5.10 (Breezy Badger) was released way back in 2005. Very few problems have been reported relative to the huge number of times that the installer has been used. If you tried the above procedure and have had no luck, it might be that there is a pre-existing problem either in the file system, in the partition table or the hard disk. First you should try running CHKDSK before trying again to resize the partition, and if you are using the Alternate CD, defragging might help. It is recommended that you run CHKDSK once again after resizing your NTFS partition. Also, try the following alternative methods:

Using QtParted from the System Rescue CD

  1. Boot into Windows and backup any valuable documents/photos etc onto removable media such as CD-R/DVD-R.
  2. Run the Windows disk check tool (Error-checking) on C: a couple of times (the results can be seen in the Administrative Tools > Event Viewer > Application under a "Winlogon" entry).
  3. Run the Windows defragmentation tool on C:
  4. Download the System Rescue CD ISO image (100 MB; has several very useful software tools).
  5. Burn the ISO image to a CD.
  6. Boot from the CD and hit Enter when you see the message "Boot:".
  7. When you get a command prompt, enter:
run_qtparted
  1. Select your disk on the graphical screen (most likely /dev/hda).
  2. Select your NTFS partition to be resized (most likely /dev/hda1).
  3. Right click with the mouse and choose Resize.
  4. Set the new partition size.
  5. Commit your changes in the File -> Commit menu. If your keyboard and mouse stop responding during resizing then please just be patient.
  6. Once your changes are saved, remove the System Rescue CD and insert your Ubuntu installation CD.
  7. Reboot and install Ubuntu into the free space.

Using GParted from UNetbootin-PartedMagic

Another approach to resizing partitions, which does not require a CD, is to load PartedMagic from Windows via the UNetbootin PartedMagic Loader:

  1. Download and install the Windows (.exe) file, then reboot.
  2. Select the UNetbootin-partedmagic entry after rebooting, and wait as PartedMagic boots up.
  3. Start the partition manager by clicking the GParted icon on the the panel.
  4. Select your disk (probably /dev/sda) via the drop-down menu on the top-right corner of the interface.
  5. Right-click the NTFS partition to be resized (probably /dev/sda1), and select the "resize" option.
  6. Drag the slider to specify the new size the NTFS partition should be resized to, then press OK.
  7. Press the "Apply" button to resize the disk, then reboot once done.
  8. Upon the next Windows boot, click OK when prompted to remove UNetbootin-partedmagic to remove its boot menu entry.

External Links

These are external links so that they're not 'officially' part of the "official" Ubuntu documentation; follow at your own risk.