Archive for the ‘Windows’ Category

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.

The end of XP

Smugness isn’t an emotion I often feel about my work, but I’m feeling pretty smug today. I took on the job of getting rid of Windows XP a few months ago and I finished yesterday. Compared to a lot of companies, I’m sure I had an easy job but the 80/20 rule certainly applied. The 80% were easy to work out how to upgrade, the last 20% much less so. Everyone in the company is now using Windows 7, mostly 64bit with the odd 32bit installation here and there for historic reasons. (Personally, I’m using CentOS 6.4, 64bit – but that’s another story.)

Mostly, user’s desktops and laptops had been replaced sufficiently recently that they were already on Windows 7. Vista didn’t exist for us. Any machines bought in that short, unpleasant period were downgraded to XP. In those cases a Windows 7 installation was simple enough. Most Windows machines benefit from a fresh installation every so often anyway, although because no two machines were the same, each had to be installed and then updated individually. That’s a dreadful process, even when you start from the most recent service pack. When you add Office as well, it can be over 10 reboots to get the machine fully patched.

The stability and excellence of VMWare was the cause of some of XP machines I had to deal with. A number of physical machines running XP had been sucked into VMWare over the years as the hardware they ran on started to fall apart. Rather than scrapping the machines and moving the software and services they ran elsewhere, it was just so much easier to virtualise them. Of course, this means they would virtually (if you’ll excuse the pun) run for ever, occasionally moving from ESXi host to ESXi host as the hosts themselves got replaced.

I was told something very early on in my working life by a very diligent, hard working colleague. It is that if you put something in your in-tray and leave it for a while, a good number of tasks just go away without you ever having to look at them. As I got to know this particular person, I couldn’t imagine him ever ignoring something in his in tray, but what he said certainly turned out to be true about a number of the old XP machines that had been turned into virtual machines. When I challenged people to explain what they needed a particular machine for, often it turned out the case for keeping them was remarkably thin or in some cases forgotten completely.

I did have to build a new print server but I was able to get rid of a few ancient printers that it turned out no one had used for ages. People might complain about having to walk further to collect a printout but mostly people like to use the printer that prints best. The nearer, rather crusty printer that gives poorer quality printing tends just to get ignored. The “spare/broken” hardware room is quite full now. The print server build turned out to be quite straight forward because the number of desktop O/S variants is as low as it will ever be. This was definitely the time to learn how to build a print server.

As I got down the the last XP virtual machine I knew it was going to a challenge. It ran some software to monitor and manage a particular piece of hardware. The hardware is still a current model (something we had provided, not something we specified). The software was written in Visual Basic, probably version 6, but quite possibly earlier. It uses DAO and an Access version 3.5 database (yeah, really). I contacted the hardware vendor directly and they supplied a Windows 7/8, 64bit version of the software. It took 3 hours and 6 emails each way but we finally got it working. It’s still an awful bit of software but by the time I got to the end of the project I just wanted this stuff to run, pretty didn’t matter.

So what about conclusions? Well everyone will say the same thing – don’t leave this to the last minute. However, I’d say don’t fear it either. For us, it turned out to be a very good clearing out exercise. Very much more so than I imagined it would be. It made me dig into all the quiet corners of our infrastructure and understand just about everything we have running. As of today, the infrastructure is a lot better understood and documented than it has ever been. The challenge now is to keep it that way.