Archive for December, 2013|Monthly archive page

Expanding the system volume in Windows Server 2003

You sometimes read about tasks that sound simple but if they go wrong you know that you have little chance of unpicking it. Resizing disk partitions is one such task. You trust to the commands and hope – debugging, let alone fixing, a broken partition table isn’t something most of us get a lot of experience of. This is the time when sys admins love virtual machines and the ease with which you can back them up and restore them.

Resizing a Windows Server 2003 system volume (usually the c-drive) is particularly awkward. I only look after two WS 2003 machines, both are virtual, both are due for replacement next year but, as sometimes happens, one of them needed more disk space. The issue is that you can’t do an on-line resize of the system volume on WS 2003. The recommended approach with a virtual WS 2003 machine is to:

  1. Shut down the VM.
  2. Use vmkfstools (I use ESXi 4.1 at present) or an equivalent to expand the appropriate virtual disk file.
  3. Shutdown another WS 2003 VM (called a “helper”) and add the expanded virtual disk to that guest.
  4. Boot the helper VM and mount the expanded disk as a data disk (i.e. not the system volume), which can then have its file system expanded to use the newly added space.

That would be fine for me except I don’t have a spare WS 2003 VM. The only other WS 2003 I have is the peer domain controller and shutting both down, even for a short time, isn’t an option unless the whole infrastructure is going down. The last time that happened was when we moved office premises and even then we considered keeping one up over a WAN link.

So what to do? In the end I settled for using a gparted live image which became my helper O/S. The process is listed in outline below. I first tested the process on a spare WS 2012 VM which was running in an ESXi 5.5 technology demonstration environment I’m building. WS 2012 allows on-line expansion of the system volume, but I figured using gparted would at least allow me to walk through the steps and gain more confidence in the process – which it did.

The process I used was:

  1. Shutdown the guest.
  2. Backup the guest at VM level.
  3. Connect the gparted iso to the guest’s virtual CD drive and set to connect at boot.
  4. Edit the guest’s settings to force it to boot into the BIOS.
  5. Boot the guest into the BIOS and set the virtual CD drive ahead of the normal boot device.
  6. Boot the guest – it comes up running gparted.
  7. gparted was simple to use…
    1. At boot time I selected my British/qwerty keyboard, British English as language and allowed gparted to boot into graphical mode.
    2. The interface shows the disks and the spare space. When selected, the disk to grow has a slider which you can use to expand to the full space available.
    3. Apply the changes.
    4. To exit gparted I had to right click the desktop and select from the shutdown menu. There seemed to be icons on the desktop but they didn’t respond to mouse clicks.
  8. When the guest has shutdown, modify its settings to boot into the BIOS again. Return the boot order to its original configuration, i.e. put the CD drive below the normal boot device.
  9. Disconnect the gparted iso from the virtal CD drive.
  10. Boot the guest up as normal.
  11. Windows Server 2003 recognised that the disk needed checking and ran chkdsk. chkdsk ran without reporting errors and then caused the guest to reboot. (WS 2012 didn’t need to do this).
  12. After reboot the guest started OK but reported a device change had occurred and a reboot was needed. I let that happen and the guest then came up cleanly.

As an aside: the ease with which you can backup and restore virtual machines at “virtual bare metal” level has transformed how I approach many tasks. I am, by nature, very cautious about taking risks with core or even peripheral parts of the infrastructure I look after. If it breaks I’m pretty well on my own and enough things fail without me helping them along. The ability to easily and very quickly backup and restore whole machines has allowed me to try out things I’d never tackle on a physical server – even if I had spare hardware, which I rarely every do. It’s a benefit of virtualisation that I suspect is largely overlooked when cost/benefit analyses are done.

Advertisements