Wednesday, February 15, 2012

Resizing Partitions on a Windows 7/Vista Boot Drive

I used to find it possible to comfortably fit a Windows XP installation onto a volume as small as 20GB; the minimum specs even suggest 1.5GB would be sufficient, but I always allowed for some growth over the life of an install. With the release of Windows Vista, the minimum space required for the OS rose to 55GB; which is substantially larger! However, should you install Windows Vista (or 7, for that matter) onto such a small volume, you will quickly run into capacity issues; as I found with my first installs of the OS.

Now, my usual solution to a system suffering from this issue would be to re-partition the drive and re-install the OS. However, recently I found myself in a situation where I did not have the time to dedicate to a full system rebuild, so I decided to try and resize the existing partitions.

The system in question had two partitions on the drive; the system partition (C:), which was far too small, and the data partition (D:), which had an abundance of free space. This boiled the solution down to two steps:

  1. Shrink the second volume (D:) by moving the start of the partition further towards the end of the disk.
  2. Extend the first volume (C:) into the newly created space.

Despite Windows having it's own disk management tool, which supports both shrinking and growing volumes, I was unable to use this tool for the entire process for two reasons:

  • It only supports shrinking by moving the end of the partition. This would mean that shrinking the 2nd partition (D:) would result in the free space being at the end of the drive.
  • The Windows tool can only extend a regular partition into contiguous space; meaning that any space freed at the end of the drive would be useless, given the above limitation.

Fortunately, there are an abundance of 3rd party tools out there that are able to resize and move on partitions, as well as perform other useful operations. Partition Magic (discontinued) and Acronis Disk Director are popular commercial applications, for example. However, being an open-source aficionado, it's hardly appropriate that I use such proprietary solutions! Instead, I opted to use GParted, which is a GUI that sits on top of the parted command line utility. It's available to download as a bootable ISO image; perfect for manipulating a system's boot drive.

Although I was confident that GParted would be able to shrink the second partition, I had read several accounts online that suggest it wasn't the best tool for resizing Windows Vista/7 system partitions. While it appeared possible, it would be necessary to perform a repair of the operating system using the original installation media. This was something I wanted to avoid if possible, so I ended up using a combination of GParted and the Windows Disk Management tool.

The Resize: Step-by-Step

So, once I had downloaded the GParted ISO and burnt to a spare blank CD-ROM, I loaded it into the machine's optical drive and started my hybrid process:

  1. (Re)booted from the GParted CD-ROM.
  2. Used the GParted tool to configure a shrink/resize operation to be carried out on the second partition (D:) that would move the start of the partition further along the drive.
  3. Checked and confirmed the operations required to achieve the desired results, before instructing GParted to carry out the resize.
  4. Waited an hour or two until GParted had finished.
  5. Rebooted into Windows Vista (and checked to ensure the contents of drive D: were accessible).
  6. Used the Windows Disk Management tool to grow the system partition into the newly available space.

To perform a cursory check of the system, I rebooted the machine, forcing a run of chkdsk to ensure file system consistency on both partitions. I was very happy to see the checks run without any issues and the system boot successfully; I saved myself a lot of work re-installing the operating system.