Main menu:

Site search

Categories

Archive

Moving a Windows 2000 installation to a larger disk

One fine day I powered up a Windows 2000 computer and it didn’t find the hard drive. Not at all.

I booted from a Knoppix 4.0 CD that I keep on hand for this sort of situation, and it mounted my hard drive just fine. I checked a couple of files, and everything looked good. Strange.

I booted from a Windows 2000 CD and went into the recovery console. I tried the usual fixes – fixmbr, fixboot, chkdsk. There was no effect.

I searched the web for similar problems and found all sorts of potential causes – a bad disk, a bad disk controller, bad memory, BIOS corruption… ugh. It’s really a pain to troubleshoot these sorts of problems, especially when it’s a personal system and you don’t have spares on hand.

I reset the BIOS to its default settings, pulled and tested the CMOS battery, and ran a memory test (memtest86, on the Knoppix disk). No problems found, and no change.

Finally, just trying things at random, I changed the hard disk type in the BIOS from “AUTO” to “LBA”. And it worked! Go figure – AUTO had worked for the last two or three years.

By this time I’d already ordered a new 250 GB SATA disk from Newegg. Even though the computer was working again, the old disk was 120 GB and nearly full, so I went ahead with the upgrade. Here are the steps that worked for me:

  1. Back up the old disk. You never know when something will go wrong.
  2. Turn off the computer.
  3. Connect both the old and the new disk.
  4. Boot into the Knoppix CD. At the boot prompt, enter “knoppix dma” to enable DMA for faster copying.
  5. On the desktop, I see /dev/hda and /dev/sda. Those must be my two disks.
  6. From a shell prompt, I run “fdisk -s /dev/hda” and “fdisk -s /dev/sda”. The former tells me that /dev/hda is 120GB (my old disk) and /dev/sda is 250 GB (my new disk).
  7. I run “fdisk -u /dev/hda” and use “p” to display the information about this disk. The “-u” is to use sectors, instead of cylinders, in case the two disks have different geometries. Write down the start and end sectors. Note the partition type (NTFS in my case.) DON’T MAKE ANY CHANGES TO THIS DISK!
  8. Run “fdisk -u /dev/sda” and create a partition with the exact same start and end sectors as on /dev/hda. Change the type of this partition to NTFS. Toggle the bootable flag to make this partition bootable. Save these changes.
  9. Copy the boot code from the old disk to the new disk, with “dd if=/dev/hda of=/dev/sda bs=446 count=1”. (Recall that in my case, /dev/hda is the old disk, and /dev/sda is the new disk. You may have to change these. If you’re not familiar with disk devices under unix, you should probably use a commercial program like Drive Image or Norton Ghost.)
  10. Copy the data from the old disk to the new disk, with “dd if=/dev/hda1 of=/dev/sda1”. This may take a few hours, depending on the size of the disks and the speed of the computer.
  11. At this point the new disk should be bootable, but the partition will be the same size as the old disk. You could make a second partition on the new disk and use that space as a separate drive letter, but I wanted to use the entire disk as my C: drive. There are two ways to do this.
    • The graphical way: Run “qtparted”. Select the first partition on the new disk, /dev/sda1 in my case. Right-click and select “resize”, and change “space after” to zero. Use File->Commit from the pull-down menu to save the changes.
    • The command-line way: Run “fdisk -u /dev/sda” and delete the partition, then re-create the partition with the SAME STARTING SECTOR but with the ending sector set so the partition is the maximum size possible. Then run “ntfsresize /dev/sda1” to finish the job.
  12. Shut down Knoppix, turn off the computer, and remove the old disk.
  13. Turn on the computer, go into the BIOS, and make sure the new disk is properly detected and selected as the boot device.
  14. Share and enjoy.

In my case, I hit another snag. The new disk worked fine, but every so often Windows would give me the error: “The file or directory C: is corrupt and unreadable. Please run the chkdsk utility.” After that, the computer would refuse to boot. I booted into Knoppix, and the files looked fine. I booted from the Windows 2000 CD, and when I tried to run the command “DIR” from the recovery console, it gave me the error: “An error occurred during directory enumeration.” Huh?

It turns out that I had hit yet another size boundary. Apparently, not very long ago, the PC industry didn’t forsee disks reaching beyond 137 GB. And although my computer seemed to be working fine, when I filled the disk with more than 137 GB of data, it corrupted the disk.

To get past the 137 GB boundary, you need:

  1. A computer whose BIOS supports 48-bit LBA (logical block addressing). I couldn’t find definitive information about mine, an ECS 865G-M 5.0 with BIOS dated 2004, but it turns out that it does.
  2. A disk that supports 48-bit LBA – if the disk is larger than 137 GB this should be a given.
  3. An operating system that supports 48-bit LBA. This was the key.

By default, Windows 2000 does not support 48-bit LBA. But if you have service packs 3 or 4 installed, you can enable 48-bit LBA with a registry key. See the article 48-Bit LBA Support for ATAPI Disk Drives in Windows 2000 for details. Why this is not enabled by default is completely beyond me.

I ended up removing the new disk, installing the old disk, booting into Windows, making that registry change, and then repeating the above steps to move from the old disk to the new disk. This time, when I booted from the new disk, I was able to fill the disk beyond the 137 GB boundary. What fun…

I hope that by posting this I can save someone else some of that trouble.

Since this adventure I’ve upgraded to the DVD version of Knoppix 5.0 and have been really impressed by it. I highly recommend you keep the CD and DVD versions in your IT toolbox.

Comments

Comment from kevin
Time: January 15, 2009, 8:34 am

Another tip: After copying the data to a new disk, you may want to reset the bad sector count (again, using Knoppix, sysresccd, or some other bootable Linux CD). The below text is from http://www.linux-ntfs.org/doku.php?id=ntfsclone:

1.
Back up important data from partition just in case
2.
Find out size of ‘$Bad’ attribute in $Badclus using ntfsinfo with ntfsinfo -i 8 <partition> (partition is for example /dev/sda1). It will be the “Allocated size” value in the “Dumping attribute $DATA (0×80)” (there will be two 0×80 attributes. Only one has an “Allocated size” line).
3.
Use ntfstruncate <partition> 8 0x80 ‘$Bad’ 0 to set $Bad’s attribute length to zero.
4.
Use ntfstruncate <partition> 8 0x80 ‘$Bad’ <ntfs_size> to set $Bad’s attribute length back to proper value which was recorded in step 2.
5.
Boot into Windows and run chkdsk. It will find errors and should fix them.

Unless you’re certain that the bad clusters were just an error, It is recommended to do a full surface scan using either your hard disk manufacturer’s tools or chkdsk /r after doing this.

Write a comment