Monday, May 09, 2005

Restoring Athene to Operational Condition - Mirroring Disks

Athene, the computer I tend to do most of my work on, had a problem with its OS hard disk - it had been making a progressively louder high-pitched whining noise over the past couple of weeks. The noise was most noticeable at night when I was going to sleep. This weekend I decided to replace its hard disk with a "new"* Micropolis Tomahawk 4345AV 4GB 7,200-RPM SCSI HDD I had lying around. It turned out to be a bit trickier than I expected.
* - New to this computer, anyway.

Note: this is a two-drive system, with an 8GB IDE drive C:, and a 2GB SCSI drive D: (before I upgraded it), running Windows 2000. Drive C: is considered a "System" disk by the OS, but drive D: is the "Boot" disk according to the OS. IDE devices get lettering priority over SCSI devices, at least on my systems.

To avoid reinstalling my operating system and all my programs, I decided to mirror the operating system to the new drive using PowerQuest DriveImage 2002. I installed the new drive as SCSI ID 2, leaving the OS drive at ID 0 for the time being, booted up, and started the mirroring process (direct disk-to-disk copy). It required a reboot, since it couldn't mirror the OS drive if it was in use (DriveImage was installed on another drive in the system).

Everything seemed to go fine with the mirroring process, but when I booted up again, the new (destination) drive was blank. So I tried to create an image file from my operating system disk. This time, it gave me a CRC error 98% of the way through the process of creating the mirror. After extensively checking the destination disk, and finding nothing wrong, I decided to sleep on it. I should mention at this point that the old (source) disk actually had a dent in it from falling off a shelf in storage.

The following morning, I decided to check the old disk using the SCSI host adapter's built in surface scan. It turns out that the old disk had a few bad sectors within 98% of the end of the disk. I remapped those, tried DriveImage's disk-to-disk copy again, and lo and behold, it worked! I had assumed that DriveImage would be more robust and check the source disk for errors and work around them if so - apparently that is not the case.

I verified that I could see the mirror image on the new disk when I loaded up Windows, so I removed the old disk and tried to boot off the new disk at SCSI ID 0 - but it didn't work. Hmm. Checking with PartitionMagic 6.0 (iirc) for DOS, it turned out the partition was hidden. I tried to unhide it, but PartitionMagic reported "Error 627 Drive geometry obtained from windows environment does not match that seen from boot mode" or something like that. I've run into this problem in the past and I haven't seen any solutions to it using PartitionMagic, except perhaps to upgrade.

However, while searching, I ran across this thread that mentioned using a free utility called Gdisk to unhide the partition. I downloaded it and ran it from a DOS bootdisk using first the /? switch for a listing of commands, then /STATUS to see the drive listing, which told me that disk 2 was the SCSI drive. Running "Gdisk.exe 2 /status" showed me the partition info for disk 2, and I found out that partition 2 was the NTFS partition (yes, I had another partition on the disk - more on that in a moment). Finally, running "Gdisk.exe 2 /-HIDE 2" (the first number refers to the disk, the second to the partition) unhid the partition, and lo and behold, it worked perfectly! Take that, PartitionMagic for DOS!

Then I tried to boot again, and it still didn't work. Remember that other partition I mentioned on disk 2, partition 1? It was a 500MB Primary partition I'd created for a swapfile on the disk, before the 3.5GB I intended as my main partition, completely forgetting that the computer would be expecting the first Primary partition to be the one with the OS. So, once I realized this, I loaded up fdisk (I probably could have used Gdisk again, but I'm more familiar with fdisk), and deleted the 500MB Primary partition. Upon rebooting, it found the 3.5GB Primary partition that had been mirrored (and resized) from the other disk, and the operating system began loading. Oh, happy days!

At this point, I had everything working again, but I wanted my high-performance beginning-of-hard-disk swap partition, so I created a 500MB Extended partition at the beginning of the disk, with a ~500MB Logical drive inside it for the swapfile. Rebooting convinced me that this worked fine (since the bootloader skips over Extended partitions to the first Primary partition when looking for an operating system).

Tip: if you already have your disk formatted and software installed, you may be able to use Powerquest PartitionMagic, if you have a copy, to move the partition up a bit, and free up some space at the beginning of the disk to create a swapfile partitition. I can rarely be bothered to plan ahead, so I usually do this.

Then, it occurred to me that I could have two 500MB partitions, one at the beginning of my 8GB IDE disk and one at the beginning of my "new" 4GB SCSI disk, and stripe the two partitions together using the Disk Manager under Win2K (right-click My Computer -> Manage -> Disk Management). I just had to convert both drives to Dynamic disks. I did that, and I was able to create a new Striped volume between the two disks (with 256K cluster size, if you're curious - I figure it's a big swap file, and hard disks read faster in larger chunks), assign it drive letter W:, and put a near-1GB striped RAID 0 swapfile on it.

So, there you have it. If you're running into problems with PartitionMagic for DOS, try Gdisk. Want an unfragmented swapfile? Give it its own partition at the beginning of the hard disk.

0 Comments:

Post a Comment

<< Home