A rather long post intended for geeks…
My father has an elderly Dell Inspiron laptop running Windows 2000. His 4GB hard disk was almost completely full, it was heavily fragmented, it didn’t have enough space to do a proper defragment, and it was starting to get quite tricky to install Windows updates etc. It was also crawling because of all the layers of Norton antivirus and firewall stuff that those lucky Windows users need.
So I wanted to replace the disk with a 40GB drive I had taken out of my old Powerbook, and do some tidying up at the same time. Tempting as it would have been to do a fresh installation of the OS and applications on the new disk, that would have been impractical; there were just too many bits. And though I had successfully switched my father-in-law’s machine to Linux in the summer, my father is rather more dependent on Microsoft Office at present. So I had to come up with a way to move the current system, intact, to a new disk with a larger partition. This post is really a record, for me, of what I did in case I ever want to repeat it, but in the unlikely event, gentle reader, that you find yourself in a similar situation, the following may be of use to you too…
The first thing I did was to get a USB hard disk enclosure so that whichever disk was inside the machine could talk to the one on the outside! I managed to find one for £22 at a local computer store. The laptop only has USB v1, so this wasn’t very fast, but it worked fine.
I also had some space on a Firewire drive and an old PCMCIA Firewire adaptor. So I had the idea that I would connect this drive up, image the existing partition onto it, swap the internal disk, restore the image onto the new one, and resize the partition to make use of the new extra space.
This would have been fairly easy on the Mac, where the ability to do things like booting from external devices and creating images of drives all comes as standard. And where, if you want to, you can just copy applications from one drive to another by dragging and dropping. On Windows it’s a lot more challenging. I could have bought copies of DriveImage and PartitionMagic. They’re good tools and they would have done the job nicely, but I didn’t feel like spending too much money when I don’t have any other Windows machines and didn’t expect this one to live very much longer. And the shops were shut. And besides, there must be a way to do this for free…
Just using Windows?
My first thought was that I could use the Backup program that comes with Windows 2000. I’d backup onto the Firewire drive, put in the new hard disk and install a basic copy of Win2K, then restore from that backup. I did all of this, which took two or three hours, but when I’d finished all sorts of applications wouldn’t run. I think, as might be expected, that Windows cannot restore onto the system disk from which it’s running. It didn’t give me any error messages or anything; it just didn’t work properly afterwards. I blame the registry…
So I had to come up with another solution.
I was curious to see how well Linux would run on this machine, so I grabbed my trusty Ubuntu CD, created a small partition at the end of the disk, and installed Ubuntu there, leaving space for an eventual Windows partition before it.
I had never installed Ubuntu on a laptop before, and on this one it was as smooth as you could possibly imagine. Not only did it deduce the somewhat non-standard screen resolution correctly, and work perfectly with the external USB drive, it also had out-of-the-box support for:
- My PCMCIA Firewire card (That really surprised me)
- My old Orinoco PCMCIA wi-fi card
- My old Xircom PCMCIA ethernet card
Amazing. I now had a solid, virus-free operating system, which was nice and fast, and getting it installed, up and running and connected to the net was much easier and quicker than Windows 2000 had been. A round of applause for the Ubuntu guys, please.
OK, so, now I needed to transfer the old operating system from the old disk (now in the external USB enclosure) into a partition on the new disk. I would need a few utilities, but these were all freely available and easy to install using the standard Ubuntu package manager.
First, I used PartImage to create a file which was a compressed copy of the old partition. I then created a FAT32 partition on the new disk of about the right size and expanded the image into that. Sure enough, I could mount the filesystem in Linux and see all the files. Looks good.
So now the only thing was that the partition was the same size as the original 4GB I had on the old hard disk, and it had about 30GB of unused space after it. I used Parted, a partition editor, to resize it without deleting the data. (If it had been an NTFS-format partition, I would have needed NTFS Resize).
Everything looked OK, so I needed to configure GRUB (a Linux bootup system thing) to allow me to boot either into Windows or into Linux. This was just a case of editing /boot/grub/menu.lst and uncommenting the example configuration for Windows.
I restarted, and Windows booted! Well, almost. It got most of the way there and then came up with a message saying that my pagefile was missing or the wrong size, and I would need to recreate it. But it never got beyond that – it just kept cycling around and showing the error to me again. Bother. So close and yet so far…
Fixing the boot sector
I did some Googling on the error message and discovered, for reasons that I don’t quite understand, that this problem can be fixed by booting from DOS or a Windows recovery disk and doing FDISK /MBR, which overwrites the master boot record on the disk. I knew that this operation wouldn’t damage my Linux partition, but it would overwrite GRUB and so delete the menu which allowed me to boot into Linux.
Fortunately, GRUB is a very small but very flexible tool. So before I did this, I created a bootable floppy with GRUB on it (Here’s how to do it).
Then I rebooted from a Win95 Recovery Disk – almost any kind of DOS-like system will work – and did FDISK /MBR, after which I could reboot into Windows and everything was hunky-dory.
I could also use my GRUB floppy to boot into Linux, run grub-install /dev/hda, and I had my dual-boot menu back. Hoorah!
All I had to do then was tidy up the Windows world, which meant virus-scanning, defragmenting, and reinstalling Internet Explorer, which had managed to become somewhat confused even before I started. I think the package from my father’s ISP had done some funny configuration on it.
I didn’t really need IE, because I’d installed Firefox and it worked just fine, in fact rather better. But other packages, like Windows Update, tend to depend upon IE so I wanted to get that fixed. It was just a small download of the basic installer from the Microsoft site and it seemed to set things to rights.
So now I hope to gently wean my dad off IE and Outlook Express, onto Firefox and Thunderbird, and show him that his files open just fine in OpenOffice, and, who knows, the next shift may be on to Linux. At which point he’ll be able to ditch his subscription to Norton Antivirus, which was the most expensive part of the entire operation!