How to: Migrate/Move a Windows XP Install to a new hard drive

CheetahMk2

Senior member
Jan 23, 2003
517
0
0
I just ran through all of this and a bag of chips, so I thought I would post the reults of my labour. I will try to also state why certain methods work and other fail.

BIG NOTE: Never ever mess with your original drive for the moment. EVER. Don't delete it, copy it, or modify it. If any of this fails, you will ahve to plug it back in and boot off of it. So don't mess with it. Until you get the new drive working 100%, consider it read-only. This includes registry keys and the like. You could run something like SYSPREP before copying, but that isn't covered here.

My first method was tring to copy everything across to the new drive directly in Windows. That will fail.
Windows File Locks prevent you from copying all files you will need over, such as your current user files or system files currently in use. We need to get around this. Additionally, checking using the SeaTools bootable CD utility, the drive wasn't flagged as being bootable. The MBR didn't think the drive could boot, so I got "BOOT FAILURE FROM PREVIOUS DEVICE" errors after POST. If you get those, check to see the drive and partition is flagged as bootable. (The bootable CD that came with my Seagate had this under 'Show advanced drive information')

Second method was using the SeaTools in-windows utilities to copy data.
This worked for the most part, but required me to repartition the new drive. This meant all data that WAS on the drive from my attempt to copy in Windows would be wiped. However, it did make it flagged as bootable. The copy process steamrolled over any errors, requiring no user input (a good thing).

But, the copy process was rather slow and some files could not be copied. This wasn't that bad, since it kept a log of which files failed. If you open up the error log after the copy which is located in the program's folder (which you should enable if it isn't already), you might see something like EVENT.LOG, which is the security logs, and aren't really that important to copy over. However, some of the other files are important, like NTUSER.DAT in your home folder. Using this in conjunction with BartPE to copy over files that are in use that are omitted from the mass copy works well.

Third method was booting using something like BartPE and copying all data over in an isolated environment.
Works great, and you should be able to access all your NTFS files, but there are some minor issues. This might run into a couple of files withe nams that are too long, and also hits a problem of directories with a '.' as the first character (e.g. OpenSSH installs a '.ssh' folder to your home directory). Also, some files may get strange errors, since the copy utility isn't all that robust. I recommend copying bulk using a drive utility available free from companies like Seagate and using BartPE for the remainder of files which were unable to be copied (as noted in a convenient .txt log).

If you cannot or do not wish to use the drive copy utility, make sure the drive is flagged as bootable, then copy directories one by one from the root so you know what directories give an error. You then have to go in and fix each problem yourself. Keep in mind the offending file may be a couple directories deep, so you have to be pretty technical to know exactly where it is coming from by just the name. Until there is a better copy utility in BartPE, this is also not that great.

Fourth method was using a drive imaging utility like Ghost from BartPE or a boot disk.
This type of software usually isn't free, so this is more restrictive. However, you can get a perfect copy from the original drive to the new one. Beyond that, all you then have to deal with is the problems Windows throws up when it is done...

Problems Windows may create when a 'perfect copy' of all files is complete
At this point you could just do a Repair Install off the Windows CD, but since that impies redownloading everything and applying all your patches and customizations we made again, we can't do that. This section is about the 'funky errors' that specificallly come up from trying to boot after copying the drive data over. You may get other, weirder errors if you are running odd bootup utilities or the like.

You may now have to worry about Permissions. (This section may only apply to power users of XP Pro who have enabled Advanced Filesharing) Windows has a nasty habbit of not allowing itself access to files, thereby making boot impossible since the critical system files are inaccessible. If you still have the good installation on the old hard drive, this isn't as much of an issue as you can always boot from that, and change the permissions on the new hard drive from inside Windows.

If you don't have the original drive anymore, you would have to somehow get it under a XP-like install where you can set security policies on all files, and 'Take Ownership' of all files on the drive. Then you may even have to set EVERYONE permissions to FULL CONTROL on everything to get it to work. In my case, I double checked permissions were sensible and inhereted (YMMV) before I did the image.

At this point I would say DISCONNECT THE OLD HARD DRIVE. Past his, it may only cause problems to have two hard drives hooked up at once. If you reboot and you get a BIOS warning, you didn't do what I said a couple of paragraphs up. If you get Windows Errors, you are at least headed in the right direction. If you boot using the Windows XP Setup CD and go into Recovery Console, you can use the command 'FxMBR' to fix the Master Boot Sector and FixBoot <driveletter> to rewrite the boot sector on that drive. There is also fdisk /MBR, which *may be destructive*. You can also use BOOTCFG /REBUILD (it has other parameters, play around) to reconstruct the boot.ini file. BOOTCFG can scan for, and then use, Windows installations it finds. If you removed the old hard drive, there should be only one, and if you run it again, you may end up with multiple copies of the same entry. If you don't have a boot.INI, the default parameter for most XP installs is "/fastdetect", and the name really isn't all that important.

Run the commands in this order: FixMBR by itself, reboot. If the problem persists, go back into recovery console, type fixMBR, Fixboot <drive letter>. Should that fail as well, go back and so the same, then use the BOOTCFG /REBUILD to fix the boot.ini.

In my situation, it started booted Windows fine when I copied over the boot files in the imaging process (boot.ini, NTLDR, NTDETECT.COM) and removed the old hard drive before booting again.

Now, if you can remove the old drive physically from the system and you can boot and log in, you are golden. Just to cleanup work from here...

What to if you get to the Login/Welcome Screen and there are no user accounts present
This part is where it gets really messy. Windows grabs a unique ID from each drive and uses it to mark that drive at itself. This is why you can have a removable hard drive and it will always get the same drive letter even if you remove it and reconnect it. It's like a drive serial number.

This also interferes in the boot process, as Windows gets confused why it just booted from a drive it previously thought was something other than C:\. (Let's use the example that it was G:\ to windows when hooked up next to it before all this). This somehow makes Windows not show any user accounts, and even disable manual login (this does nothing if this is the case). Also, when trying to boot into any type of safe mode, you will get the login screen with no accounts. This is the same reasoning, so don't bother.

What you need to do at this point is documented
here. For the sake of brevity, you basically need to go into the registry and change the drive ID-to-letter associations around so that it thinks the drive it just booted from WAS the C:\ drive. But how do you edit the registry if the computer won't boot, you ask? And you can't edit the raw registry files from Recovery Console? The answer is below.

How to edit the registry hives from the files stored on the hard drive without booting that installation
First you need a BartPE disk, or a WinPE disk. Anything which can run natively regedit.exe will work, although BartPE is more useful overall, an this only covers that. When you run regedit.exe on BartPE, you will be given the registry of BartPE itself, not that of the drives under it. You need to click on HKEY_USERS to highlight it, then click File->Load Hive. Then merely browse to <New Drive Letter>:\Windows\System32\ and type *.* in the file box, hit enter to display all files, then select SYSTEM. You should type a name like TEMPORARY so that you don't accidentally overwrite something or merge it with an existing key. Go to the registry key \HKEY_USERS\TEMPORARY (or the name you typed)\SYSTEM\MountedDevices . Then just find what your Old Windows install called the new drive, and swap the names.

Example (old drive thought the new drive was G:):
"\DosDevice\C:" 31 c1 30 21 02 13 51 23 13 <- Your original drive
"\DosDevice\G:" 00 2a 2b 4f 22 ac 12 c3 02 <- The drive you just copied everything to
"\DosDevice\I:" 22 da 2a 21 50 f8 12 43 a2

Right click on \DosDevice\C: and rename it to be another letter, whatever you want Windows to call the drive when you hook it up again (*do not* use a letter already there, in this case I:). Then, right click on the new drive (remember, it was G: to your old windows install) in this case, \DisDevice\G:, and change it to C:\. Now click File->Unload Hive, and the changes should be saved to the registry file on the new hard drive! Reboot, remove the CD, and you should be staring at the same welcome screen of the drive you imaged as if you just logged back on.

Hope this helps!
And remember, I can take no reponsibility if you nuke your own data or image the wrong direction, yadda yadda yadda so just be careful. This isn't meant to be a walkthrough, only how to go about it if you happen to be doing the same thing I did. Keep that in mind.
 

mikeford

Diamond Member
Jan 27, 2001
5,671
160
106
Ghost is the way to go. Its on the cheap (about a year old) SystemWorks CDs, and came on the CD included with most of the motherboards I have bought. Never versions are better with easy support for CDR burners etc.

I like to make a ghost backup at the earliest possible point after the OS is installed and updated, but before any software. Much faster than doing a reinstall if needed.

Make sure to use the same names for all drives, PCs, users etc.

All it takes to really learn to hate windows is using it often enough. ;)
 

fuzzynavel

Senior member
Sep 10, 2004
629
0
0
A word of warning......my wife got a new HD and we ghosted her old HD and put it on her new one....Now norton internet security is refusing to work...possibly has some sort of hardware ID check...
 

mikeford

Diamond Member
Jan 27, 2001
5,671
160
106
Norton causes as much trouble as it fixes. Here is the glitch as I understand it, during install and updates Norton looks for some files, which can be missing, present, or corrupted(including the wonderfull, wrong version or date or something). In the first case, missing, it won't update. In the second case it may work, or may not install, or may install funny. Last case is what I think I have, eternal failing updates.

You might think the files could be easily deleted, but they are not even easily found, and NOT removed via uninstall. I gave up, now just waiting for a good time to backup and format and start from scratch.
 

Basilisk

Senior member
Sep 15, 2000
774
0
0
I'm trying to migrate an XP Pro system to a larger boot disk, and failing. I've done this many times for Win 98* systems, but this is the first time I've tried with Win XP. All I get on booting to the new disk is "Disk Boot Failure, Load Disk" (or something like that).

- I've used Ghost to clone the boot disk. but that's not working...

I can still boot from the olde disk by playing with the BIOS (setting the boot disk to HD2), so I've used that to examine the disks and play about.

While I haven't used Ghost under XP until now, I've presume it's fully copied the boot partition. If so, that suggests there is some external (to the partition) flag that might need setting: if so, I haven't a clue about it, or what tool to use to set it.

---

I've now run Norton Disk Doctor on the new partition, and it has fixed some flag -- it found there was no bootable partition on the drive! But... nothing looks different under the Computer Management/Disk Management tool: how was I -supposed- to know this flag wasn't set? What M$ tool was supposed to identify it???


XP boots one step further with this flag fixed: now it says "NTLDR" is missing! Yet that file -is- present on both the new and old disks. Studying "missing NTLDR" on the M$ support site, I'm led to presume that my ROOT directory has become fragmented, with NTLDR falling out of the first area of the directory. #$%^&amp; Did Ghost do this to me? What else could have done it on the just-cloned drive? The problem can apparently arise after a large number of files have been written into the ROOT directory: while that may have happened at some time, those files were not present when I did the cloning.

Since I've no idea of how to repair this, I'm letting Norton Speed Disk run over the partition, hoping it will move NTLDR into the first part of the directory. I'll edit this posting when/if I find anything that fixes the problem. But, I'd sure like to know a sane way to diagnose and fix this problem!