Introduction

It is possible to have several partitions on a hard drive, each of which can contain an operating system (for dual-boot or multi-boot purposes). In order to make room for an Ubuntu partition, however, a pre-existing Windows partition may need to be shrunk first. This page details the method for resizing Windows partitions.

Recommended Preparations

Before editing the Windows partition, you should backup, clean, run a file system check, and/or defrag the partition.

Backup

It may seem obvious, but you should always back up important data to an external medium (CD, DVD, USB flash drive, or external hard drive) prior to manipulating your hard drive, in case it becomes corrupted. You should also clean up unnecessary files on the hard drive.

Run CHKDSK

CHKDSK is your file system checking tool in Windows and it is used for fixing errors and displaying a status report. If the status report indicates no health problems in your hard disk, then it should be safe to go ahead with your resize operation.

The easiest way to run CHKDSK is to schedule it to run on the next reboot. Just go to 'My Computer', right-click on drive C, select the 'tools' tab, and click 'check now' in the 'error checking' section. Make sure you check both squares, one for 'automatically fix system errors', and the other one for 'scan for and attempt the recovery of bad sectors'. Windows can't check your file system while it's mounted, but you can set it to do so at the next reboot.

Some people run CHKDSK from a Windows Recovery Console in a Windows Installation CD, and this is sometimes necessary if Windows won't even boot. You need to make sure you use a CD for your version of Windows because there are different versions of NTFS. If you run CHKDSK from a Windows Recovery Console, be sure to run CHKDSK /R, for a thorough file system check which will take longer, and includes /F (the option for automatically fixing errors).

Defragging

If you are planning to use GParted, you can skip defragging and save yourself some time, because GParted can resize an NTFS partition safely regardless of its state of fragmentation. See How to resize NTFS without data loss? (Feb 24, 2005)- The ntfsresize Frequently Asked Questions, and 2.4.13 resize - Parted Users Manual

If you're planning on using Windows Disk Management, most people will advise you to defragment, possibly overnight. Very often while you're defragging, there will be a large green bar in the middle of the Windows partition that seems to be immovable. That's the Windows 'page file', and you can turn that off before defragging if you need to (which often times you don't). Go into Control Panel and in 'System', 'System Properties', and then 'Advanced' tab, look for the 'Performance Settings' button. In the Advanced tab look for 'virtual memory' and be sure to take note of your settings on paper before making any changes. Then click the button for 'no paging file' and click 'Apply'. Now you can run defrag without the big green immovable bar in the way. Remember to turn your paging file back on later on or your Windows operating system might be slowed down.

Resize the Windows partition

A Windows partition should be at least 20 GB (recommended 30 GB for Vista/Windows 7), and the Ubuntu partition at least 10 Gb (recommended 20 GB). Obviously, if you have plenty of disk space, you can make the partition for your favored operating system larger.

Windows XP

If using Windows XP (or an older Windows OS), you should use GParted partition manager to shrink the Windows partition and leave free space on the hard drive for the Ubuntu partition.

Windows Vista and Windows 7

There are several ways you can reduce the size of a Windows 7 or Vista partition. It doesn't really matter which one you choose. Linux programs get the job done faster because you don't need to defrag first, but using the Windows Disk Management would be the more conservative option.

Two of the free Linux partition editors are on the Ubuntu CD, one being the installer and the other being GParted Partition Editor.

Ubuntu CD Installer

The Ubuntu installer has its own inbuilt partitioner so there's really no need to partition your disks beforehand if you don't want to. The Ubuntu CD's partitioner is based on GParted, but doesn't round cylinders or move the start of the Windows partition. Windows will run a normal file system check on first boot-up and then it will boot normally.

GParted Partition Editor

If you decide to use GParted, you have to remember to uncheck the 'round to cylinders' checkbox , otherwise GParted will dutifully move the entire partition to align it with cylinder boundaries. Unfortunately this takes a long time, and when it's finished, usually results in booting problems. This is because the Windows boot loader depends on block addressing to find parts of itself, so when the partition is moved a little, it gets all mixed up and disjointed. Sometimes it can fix itself automatically but other times it requires repairs from the Windows Installation Disc. If you just remove the check mark you will find that GParted will be able to complete the NTFS resize in a fraction of the time it would have taken otherwise and afterwards Windows will boot just fine.

Some hardware vendors (such as Dell) ship with the maximum of four primary partitions occupied. It is simpler to install Ubuntu on at least one primary partition (using Windows bootloader is required for installing on a logical partition). Using GParted may be preferable in this circumstance to utilize the space occupied by the recovery partition or media direct partition.

Windows Disk Management

The Windows Disk Management tool is also good at shrinking Windows. It's very fast and easy, if you don't count the time it takes to defrag first. If you want to use the Windows partition editor to resize Windows, here's how you can do that:

Administrative Tools --> Disk Management tool -> Shrink Volume

In Windows Vista and Windows 7, this may be located in:

Settings -> Control Panel -> Administrative Tools -> Computer Management -> Storage -> Disk Management -> Shrink Volume

Immediately Reboot Windows After Shrinking Partition

After shrinking the Windows partition, you should reboot once (or twice) into Windows prior to installing Ubuntu. This allows the Windows system to automatically rescan the newly-resized partition and write changes to its own bootloader configuration files.

If you start mucking around with other partitions before Windows has a chance to reset itself, the Windows bootloader will not be able to read the partition table properly and will not boot entirely. If this happens, you may later have to repair the Windows partition bootup files manually using the Windows Recovery Console.

Problems

As with all major changes to a computer, problems may sometimes occur, especially if dealing with Windows Vista or 7.

According to one Windows user:

Unlike Windows XP, Windows Vista and Windows 7 do not allow you to move the MFT (Master File Table) that controls the NTFS file structure within Windows. Inexplicably, Microsoft locates this near the middle (or end) of the partition, somewhat limiting the ability to resize (shrink) the partition completely. Although you will be able to gain some hard drive space from the "Shrink Volume" command, it is likely to be limited.

I knew of no partition software that could move the MFT to a different place on the hard drive safely, but this tutorial suggested that Perfect Disk worked for this purpose. I therefore tried the trial version of Perfect Disk, and it seemed to work for me very nicely. I was able to shrink my Vista partition, using the steps in the tutorial (and Perfect Disk), from 300 Gb to 74 Gb. This was perfect for me.

However, the partitioner in the Ubuntu installer has been used quite successfully by thousands of people for years and there's really no reason why you can't just use the Ubuntu installer's inbuilt partitioning program.

If you find you cannot boot into Windows, this guide on recovering Windows may help.

Other resources

HowtoResizeWindowsPartitions (last edited 2012-09-20 02:59:30 by modemcable106)