Rescuing my Workstation

I bought 2 MB RAM from someone at work to install in my home machines. Turned out to be quite a saga of events getting this going. As I type these words on my good old Dell Precision i380 workstation on Sunday, just a few days ago I wasn't sure this machine was going to be around.

Different kinds of RAM

The RAM is two 1 GB chips of DDR2, 240 pin. The packaging & specs didn't say any more. I opened up my laptop, an old Dell Latitude 610, through a small cover panel in the center of the bottom. The RAM chip there is half the length - it's 200 pin with 100 pins per side. So I went to my trusty workstation, which had 2 GB of RAM, quad 512 MB chips. I removed two 512 MB chips and replaced them with the 1 GB chips for a total of 3 GB. Upon reboot, BIOS complained of mismatched memory type. It showed the original chips as ECC, the new ones as non-ECC. All chips must be the same - ECC or non-ECC. But none of the chips are marked in any obvious way as ECC or non-ECC.

Next I opened Michelle's new computer, which had 3 GB of ram - dual 1 GB chips and dual 512 MB chips. I tried her 1 GB chips plus the new ones. This worked - apparently the chips in her machine were non-ECC. When my machine booted to XP, a couple of seconds after displaying the Windows boot splash it crashed. No blue screen, just straight back to the startup BIOS. This is a triple boot machine with Grub 0.95. Long story short, the machine could boot Ubuntu 11 but it crashed trying to boot XP or Red Hat.

I installed all four 512 MB ECC chips in Michelle's computer. It booted up and ran just fine. Next, I swapped memory again, putting the four 1 GB chips into Michelle's. It booted up and ran just fine. I swapped the four 512 MB ECC chips back to my computer - their original home - and it crashed just as before.

This is bad news.

What the Heck is Going on Here?

The new memory tested OK with memtest86 in my workstation. If my box could successfully boot Red Hat or Ubuntu, I'd assume it was an XP problem. But because both Red Hat and XP were failing to boot, it didn't seem likely to be a disk problem, as each is in a separate partition. I thought it might be a problem with the motherboard that Ubuntu was simply ignoring.

I pulled up the motherboard part number and checked availability. It could be purchased for $100 - $200 depending on the source. But the last thing I wanted to do was go through that effort and find the machine was still down. It still could be a disk problem, something that affected the master boot partition, Grub 0.95, or both the XP and Red Hat partitions. The XP and Red Hat partitions were both near the top of the drive, while the Ubuntu partition was at the bottom. Being at opposite physical ends might explain why they were affected while Ubuntu wasn't. The disk partition looked like this:
| XP-NTFS | RedHat-ext3 | swap | FAT-32 | NTFS | Ubuntu-ext3 |

Recover the Disk

My next step was to restore the XP partition and get it to boot, no matter the cost. First, recover. If that fails, reload in place. If that fails, reformat (just that partition/drive) and reinstall. Fortunately, I NEVER put user data in the XP partition. Even my home "Documents and Settings" directory is relocated to a different drive & partition. So I could reformat without losing any data. Of course, reloading XP from scratch with a reformat would still be a major PITA, because I'd have to reload tons of applications.

I booted to the original Windows XP install CD that came with this workstation. Went to (R)ecovery console, tried fixboot. Rebooted, failed (same crash). But now, the GRUB menu no longer appeared, so it did in fact do something. Next, went to the recovery console again and tried fixmbr. No effect - so much for the recovery console.

Booted to the XP CD again, this time installed Windows, but did not format what was already there.

Looked promising - installer ran for about 45 minutes and got about 90% of the way through. But then, after switching to graphics mode right near the end, it encountered a mysterious problem. "File cannot be copied". The file did exist on the CD, and the disk I was installing to was nowhere near full. Absolutely no idea why this file couldn't be copied, and no error messages or logs to help. Back to square 1.

At this point I wasn't actually too discouraged because:

  • The machine had been running reliably for hours - no mysterious crashes or hangs. This means the motherboard is probably OK.
  • It does look like there is indeed some kind of disk problem. If so, this is solvable with no data loss.
  • Next step, I booted to the XP CD again, jumped to the recovery console and ran a "chkdsk /R". This should scan the entire disk and flag any bad sectors. That took a long time, even for a small 10 GB partition. After that I booted again and ran a full install of XP with format of the partition. Success!

    Where's my Ubuntu?

    Now my workstation will reliably boot Windows without crashing. But the installer overwrote the MBR and my GRUB boot menu is gone. Ubuntu is there on my disk, but it's not bootable or accessible. I need to restore GRUB.

    I decided to restore GRUB 2 instead of the original GRUB 0.X I had before. This would be easier and more functional. But how to do this w/o reinstalling Ubuntu? Here are the options:

  • Boot to Ubuntu CD, run installer to custom disk partition, don't change anything, hope that it asks if I want to install GRUB, then hope it lets me exit without doing anything else.
  • Boot to Ubuntu CD, jump to cmd shell, enter commands to install GRUB 2, scan for bootable partitions and activate them.

  • I opted for the latter. The problem is, once booted to the CD in a cmd shell, the hard drive's root partition is not mounted. It's simple to mount it, but it can't be mounted to "/". That means we need some way of running GRUB and telling it to use a specific directory as "/". After some Googling and a few false starts I found this: [TODO: insert link here]. Worked like a champ - rebooted and saw GRUB.

    This Disk is a Mess!

    Now I needed to clean up my disk. Remember it looked like this:
    | XP-NTFS | RedHat-ext3 | swap | FAT-32 | NTFS | Ubuntu-ext3 |

  • I didn't need Red Hat anymore, should remove it and reclaim the space.
  • Should convert the giant (150 GB) FAT-32 partition to NTFS.
  • Should merge the two adjacent NTFS partitions

  • The only reason I created this FAT partition was so my ancient Red Hat could read the files. That was back before Linux could read & write NTFS. It takes FOREVER to process giant FAT partitions, whether defragging or running "fsck" or "chkdsk".
    When complete, my disk should look like this:
    | XP-NTFS | swap | NTFS | Ubuntu-ext3 |
    Where "swap" is used by Ubunutu and "NTFS" is shared by XP & Ubuntu.

    Time for a little partition magic! I mean that only figuratively, because I used the Gnome Partition Editor. It does everything Partition Magic does, and more, and it does it more reliably, and it's free open source. I downloaded the ISO, burned a CD and booted to it. I noticed that it took FOREVER for it to show the partition table because it always did an "fsck" on the giant FAT partition. To get around this, I opened a cmd shell, ran "top", saw the "fsck" process. Then opened another cmd shell and did a "sudo kill X" where X was the PID. This didn't break anything because there was nothing wrong with the filesystem so the check wasn't writing anything. It saved me about 15 minutes per run, and I had to run through many times, so it amounted to hours saved. But, then I realized I should merge FAT-32 to NTFS before repartitioning, so I booted to Windows.

    Mission: convert a FAT-32 partition to NTFS. I booted to XP and ran "convert.exe". It took about 3 hours to complete, and during the last hour or so it was apparently hung, using practically no CPU or memory. But I let it sit, and it eventually did finish. When I Googled this some of the articles I read said it might use a too-small block size, but the block size was 4 kB, same as the first NTFS partition, and as I desired. Now I had two NTFS partitions next to each other and was ready to repartition.

    But it's impossible to merge two partitions. Instead, my goal was

  • Copy all files from the 2nd NTFS partition into the first
  • Delete the 2nd NTFS partition
  • Grow the 1st NTFS partition into the reclaimed space

  • The first step - copying the files - had to be done from XP, so I did that.

    Next I rebooted from the GPartEd CD again. Here's what I changed:

  • Delete the Red Hat partition
  • Grow the XP-NTFS partition into the reclaimed adjacent space
  • Delete the 2nd NTFS partition
  • Grow the 1st NFS partition into the reclaimed adjacent space

  • Now that there was no longer any giant FAT partition, GPartEd ran much faster. No need to pull up a terminal and kill the "fsck" because they only took a minute or two.

    Now, finally, my disk partitions look like this:
    | XP-NTFS | swap | NTFS | Ubuntu-ext3 |
    Where "swap" is used by Ubunutu and "NTFS" is shared by XP & Ubuntu.

    Why Won't My System Boot?

    Now, of course, GRUB won't boot Ubuntu because the partition numbers have changed. From the GRUB menu, I hit (e) to edit the boot commands and replaced /dev/sda7 with /dev/sda5. This booted Ubuntu. From there, I ran "update-grub". This rescanned for bootable partitions and reconfigured GRUB. Also, I updated "/etc/fstab" to reflect the changes in the partioning and mount the right drives to the right places.

    We're Not Out of the Woods Yet!

    My XP CD was about 5 years old so I fired up Windows update. It took ALL DAY LONG before my machine was up to date. Each update had some big-ass change that had to be done separately from the rest and required a reboot. Upon reboot, that one updated introduced new dependencies, each of which needed its own updates and reboots. I lost count of the number of update passes and reboots, but it had to be in the range of 15-20 times. And it can't be done unattended or simply. One has to scrutinize each item in the list, because Microsoft often hides a bunch of crap you don't want or need in the middle of a list of essential updates. Finally, I reached the end of the tunnel - my XP was fully up-to-date.

    One final reboot pass to ensure GRUB was right, Ubuntu was right, XP was right, all files were accessible from both sides. BINGO! I'm done.

    One Final Pass

    The job is never actually done. I found 2 problems with using NTFS from Ubuntu (or any other Linux):

  • Permissions: NTFS doesn't support unix type permissions, some apps require them and don't work when files are on an NTFS share.
  • Performance: NTFS read/write speed is slower than when on Windows.

  • These problems don't exist on the ext4 filesystem. So I converted my boot ext3 partition to ext4, and repartitioned the disk again. I shrank the NTFS partition and created a large new ext4 partition for bulk data.

    NOTE: only 1/3 of the NTFS partition was in use, so I should have been able to shrink it to half it size. But GPartEd failed to do that. I had to shrink it to slightly greater than half its size, which took about 5 hours on a fast disk (read = 60 MB / sec, write = 30+ MB / sec). Then, when that was complete I shrunk it again to get the size I needed.

    Now my disk looks like this:
    | NTFS-XP | swap | NTFS-data | ext4-data | ext4-boot |

    I Like Ubuntu, but I'm Not a Geek!

    I like Linux a lot, whatever the flavor, though CentOS and Ubuntu are the ones I'm most familiar with. It's a real operating system having a full featured useful cmd shell plus good performance, support, a great desktop and - finally - good applications! Open source is a mixed bag and you have to do a bit of research, trial & error to find good apps. But the good open source apps rival and in some cases exceed the quality of professional software. Unix installation is quicker, easier and more complete than Windows. Management of updates and software - apt-get, Synaptic, etc. - is also more seamless.

    I would like nothing more than to use Linux all the time. What's holding me back? The stuff I do. Here's what I can do on Linux:

    Web (Firefox): Firefox 4 + Java & Flash, FileZilla, ftp, curl, wget, etc.
    Email (Outlook): Evolution or Thunderbird
    Canon RAW photo files (Phase 1/Capture 1): UFRaw and Gimp, et.al.
    CD/DVD burning (Nero): K3b (Brasero, which comes with Ubuntu, turns good CDs into coasters and is slow)
    CD jewel case label printing (Epson): Kover, et.al.
    Printing: Ubuntu prints to Windows shared printers, but getting drivers can be hard
    Skype: has a beta version 2.2 for Linux
    Local web server: Apache 2.X
    RDBMS: Postgres 8.4 and related support tools
    Dev: Sun Java (the OpenJDK that comes with Ubuntu is a good effort but not yet ready for prime time) Eclipse, BlueFish, Ant, Maven
    Audio: Audacity 1.3, Lame 3.98, Ripper X, Banshee
    Video: VLC doesn't work well with Ubuntu, so I use Movie Player, Banshee, & PiTiVi
    Music composing (Finale Notepad): MuseScore
    Hardware drivers (web cams, etc.): has not been a problem
    Scripts: Python, Ruby, etc. part of Ubuntu
    Games: Ubuntu has some really nice games. One of my favorites is Battle for Wesnoth, a turn based strategy game. It's a truly amazing game. The scenarios, content, gameplay, and production quality of graphics & sound are superior to most commercial games, whether for PC or console.

    On Linux, it's also easier to build stuff from source. Most open source is designed to build on Linux and usually works the first time with no issues. Can't say the same for Windows... requires Cygwin, and generally complex/buggy/painful experiences.

    Ubuntu Software Center: Awesome!

    The Software Center is an app that browses a huge repository of available software and makes it all available for download. It is searchable, and it groups software by category and shows user ratings & reviews. It is similar to Apple's App Store. But unlike the App Store, most of the free software is open source and is not polluted with ads. I can't express how great a tool this is. I have been able to find every app I need, from VPN to games to office, you name it. Most but not all of the software is free and open source. 5 years ago when I last tried Linux, you had to download tarballs, build the source and install manually. Now you click one button to install, one to remove (or issue one shell command, if that's your preference). I have yet to see so much as an installer dialog. It just works, much like installing on a game console or an iPad/iPhone.

    The Software Center also shows all the software you have installed and enables you to remove it. It coordinates with Synaptic Package Manager, the Update Manager, and the command line "apt-get". Anything you install, update or remove in one tool is consistent with the others.

    What I can't get on Linux

    I occasionally have to boot to Windows (or use a different PC running Windows) for some things. Here is what they are:
    iTunes: sync iPhone & iPad
    TurboTax: Windows only (but may do online)
    Adobe Digital Editions (library eBooks)
    Describe word processor (12+ year old old files)