Category: Open Source

Using Linux to upgrade a Windows machine

A rather long post intended for geeks...

The Problem

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...

Getting started

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.

Using Linux

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!

Closing remarks

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!

Where 'ave Ubuntu?

Some of you will have read my distressed posts last month from my in-laws' house as I tried to deal with their virus-ridden PCs (here and here), so I just thought I'd bring the story up to date.

One of the machines, the Win98 one, was not only really dead, but really most sincerely dead. And we had no original CDs to reinstall the OS, and no real budget to buy a new OS. So it seemed like the ideal time to make use of a free one!

Fortunately, we now had broadband, so I downloaded Knoppix, which is a version of Linux that can run from a CD. I burned one on my Mac, used it to boot up the dead machine, and managed to copy off the documents, photos emails and address book onto a flash drive. I then downloaded and made an install CD of Ubuntu, probably the first Linux distribution that comes close to being usable by normal people, and with great relief I reformatted the disk and obliterated all traces of Windows 98 from the machine, never to darken its hard disk again. Ubuntu installed beautifully, and we had a working machine again.

We then needed to connect it to the network, and, sadly, the new NetGear wifi card that was in it was not supported. I had checked this in advance, and knew that I needed to get and build some new drivers, which, with the aid of these instructions and a few flash-drive transfers from my Mac, I was able to do. This goes to prove that ordinary users may be able to use Linux now, but they probably wouldn't be able to install it. The same is true of Windows too, though; the scale of difficulty may be different, but either would be equally unthinkable for many people.

So now my father-in-law runs Linux. His demands don't extend much beyond email, solitaire and some occasional web-browsing and simple word processing, and it's just fine for that. I can connect in from the other side of the world and install updates etc, and thanks to the VNC support built in to GNOME, I can view his desktop and help him with problems, and I sometimes leave post-it notes there for him after I've adjusted something in the middle of the night. It hasn't been rebooted since I left a month ago.

I also gave the other machine - a Windows XP one - a good spring clean. I ran lots of checks, installed Windows security patches, paid for and installed a new Norton Antivirus with the very latest updates, and so forth. And it's now behind a firewall.

A week after I left it had a new virus on it. We're still trying to get rid of it.

OpenOffice 2.0 preview released

This Inquirer article lists some of the good things coming up in OpenOffice 2.0. The most important new feature is probably the database facility. The two most critical things missing in the Open Source world, I think, have been a good alternative to Microsoft Access, and a good accounts package. It will be interesting to see how close this comes to dealing with the first one. Link from LWM

Habari!

Jambo OpenOffice.org is a new version of OpenOffice translated into Swahili. Mzuri sana!. From Living Without Microsoft:

"A Microsoft spokeswoman said that Windows and Office are not available in Swahili at present."

And they probably wouldn't be affordable for most people if they were! More info at Kilinux. A sort of Tyndale for technology...?

Supply and demand

[Original Link] Doc Searls, the editor of Linux Journal, writes an email column called Suitwatch, "Views on Linux in Business". From the December edition:

At PC Forum in March 2003, I asked Intel COO Paul Otellini why Intel didn't release Linux device drivers along with ones for Windows. He pleaded absence of demand. I replied: "There are two ways that markets happen. One is you wait for the demand to materialize and satisfy the demand. The other is you invent something that's killer, and the demand follows. By one, necessity mothers your invention; by the other, your invention mothers the necessity. "

vi and cursor keys

If you use the vi editor, and you sometimes find that your cursor keys don't work, then you should read on. Anyone else should go and do something more fun. And we vi users should probably give up on it and use another editor. It is the 21st century, after all.

I often have this problem, and it's generally when I'm ssh-ed into a remote Linux box, which is the main time I use vi. The problem is that the machine at the far end has the wrong idea of what type of terminal you have. In my case, it tends to think that I'm on an 'xterm' or an 'xterm-color', which I'm not, but that's what the Terminal app on my Mac is configured to look like, and the value gets carried through to the other end.

The best thing seems to be to set the terminal type to 'linux' on the remote machine. There are several ways to do this:

  • You can set it at the local end for the ssh process:
    TERM=linux ssh me@remotemachine
    and the value should be carried across.
  • You can set it in the environment at the remote end, eg.:
    export TERM=linux
    vi filename
  • You can set it in vi, once you discover things aren't working:
    :set term=linux
  • You can put set term=linux in your .vimrc file at the far end. This seems to me to be the most useful if you hit the problem regularly.

Allied Irish Bank migrates 8000 systems to Linux

[Original Link] "We are predominantly using [Linux] as a platform to deliver the Mozilla browser," says Michael Bowler, the bank's IT architecture manager. "The client operating system doesn't really matter from the perspective of delivering line-of-business functionality."

SCO starts suing Linux users

[Original Link]

Some of this article is just amazing:

When asked why his company had decided to sue end users rather than Linux distribution vendors, Stowell says: "If we did that, in some cases it could really hurt Linux, which is not necessarily something we want to do as a company. ... If you go and sue a Linux distributor, that could potentially hurt the Linux marketplace."

It would be funny if weren't so dangerous.