Geeks With Blogs

Welcome to my blog.
Here's what we've got on the menu today:

Lorin Thwaits A geek says what?

I recently bought a bigger 80 gig hard drive for my laptop, and wanted to copy the contents of my existing 30 gig disk with an XP install over to it.  I didn't want to go buy any drive copying tools or anything else, I just wanted a straightforward and free way to copy everything.  I could use the Backup program found in the Accessories / System Tools folder of an XP install to do a backup including the System State, but that would mean finding someplace to temporarily stash a 30 gig backup file.  And doing the restore would mean I'd have to install the OS again, and then restore that 30 gig backup file over it.  Not my idea of fun.  Instead, I wanted to simply copy every single file from the old XP installation over to the new disk, preserving all the permissions, encryption, etc.  Everything.  It's not possible to copy this stuff from the OS you're booted into since system files like the registry or pagefile are in use.  But all of this is possible by using a little-known feature of the Windows Vista DVD.

During Vista installation, you're actually booted into a lean copy of Vista itself that understands NTFS and provides the powerful tool RoboCopy to make an exact duplicate of an existing installation.  It also lets you create new partitions with DISKPART, and Format them using the standard FORMAT tool.

My first step started while still booted into XP on the old disk.  I cleared out all the Temporary Internet files since most are quite small and having so many of them will slow down the copying process.  I then shut down the OS and removed the batteries and unplugged the power adapter.  For those who have not taken a screwdriver to their system in the past, it's important to make sure there's no chance that power is reaching any component as you change pieces of hardware.  I then removed the old 30 gig hard drive from the laptop, and set it to the side.  And finally I put the new blank 80 gig disk in its place.

At that point I powered up the system with the Vista DVD in the drive to get into its Setup.  Not that I was going to actually install Vista, only use it to copy the XP operating system.  You have to select a language and click "Next" on the first screen that appears.  Then click "Install Now".  When you're asked for your product key, there's no need to go any further with what would be an installation of Vista.  Instead press SHIFT-F10, which is the back door to open a standard Command Prompt in this mini copy of Vista.

Since the new disk was completely blank, I needed to create a new partition and format it.  This is done in the DISKPART tool.  After running the DISKPART utility, you're brought to its prompt.  Here's the commands I issued to partition and format the disk:

LIST DISK (Shows the disks attached)
SELECT DISK 0 (Selects the first disk)
LIST PARTITION (Shows the partitions on the first disk)
CREATE PARTITION PRIMARY (Creates a new primary partition on the first disk)
LIST PARTITION (Shows the partitions, and now there is one)
SELECT PARTITION 1 (Selects the newly-created partition)
ACTIVE (Marks the new partition as active, or bootable)
FORMAT QUICK (Formats the partition with NTFS)
LIST VOLUME (Shows the newly-formatted volume)

By default it creates an NTFS partition with a 4K cluster size.  Perfect for most users.  The tool also lets you do fancy things like mirror disks, shrink and grow partitions, and so forth.  But the above commands were all that I needed for this job.  If you want to learn about additional commands you can use from within this neat Vista Installer, this previous blog post will give you a little overview.

With that done, the final LIST VOLUME command from above showed that I had a new empty partition on the 80 gig disk.  My laptop doesn't allow more than one hard drive to be attached internally, so I used one of those common little USB adapters out of an external disk enclosure to connect the old 30 gig disk to the laptop.

It was recognized properly by Vista's installer, and showed up as the E: drive.  Doing a RESCAN and then LIST VOLUME from DiskPart showed it was in place.  After exiting DiskPart with the EXIT command, I could also see a directory of the old drive by doing "DIR E:".

Okay, so now it's time to copy every single file, encrypted or not, including hidden and system files, and all the associated permissions.  The RoboCopy tool is perfect for this, and included right on the Vista DVD.  I simply issued this command:

ROBOCOPY E:\ C:\ /e /efsraw /copyall /dcopy:t /r:0

At that point it took about an hour to transfer all the old files to the freshly formatted disk.  A little trick to speed up this process is to minimize the vertical size of the Command Prompt window.  Since the hardware acceleration for the display adapter is not enabled when you're in this mini-installer, it takes much longer for the machine to spit every line out to the window, scrolling the previous lines.  Less screen size means it has less to update, and thereby does the copy faster.  You can squish it down to be just one row tall, and speed up the process significantly.

After the copy had completed, I restarted the machine and it booted directly into XP, configured exactly as it was before with all the same drivers, software, etc.  The same kind of treatment that I used to have to pay for with a utility like Partition Magic or Norton Ghost.

If you have ever changed your motherboard in the past, it's possible that the system will ask you to activate again, and give you 3 days to do so.  For those that are on their first motherboard, it's probably not going to be an issue.

Duplicating the disk like this is a great way to have a safety net to go back to.  After all, most hardware failures will occur in the first month or so after you install a moving part such as a hard drive or power supply.  If it's going to fail, that's the window in which it will do so.  Keeping your old hard drive around with all the same files on it as you had before is a great form of insurance to make sure you don't lose anything to a flaky piece of new hardware.

Also now if I want to upgrade to Vista, it's very low-risk because in a worst-case scenario I can go back and copy the contents of the 30 gig disk again.  Some people prefer instead the "clean slate" method when upgrading.  But I haven't had trouble with Microsoft's upgrades, so I'm sure I'll upgrade this system to Vista in the near future.

For anyone who runs into trouble during a transition like this, additional info is available here.

Posted on Thursday, December 7, 2006 9:39 AM Vista | Back to top

Comments on this post: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Lorin Thwaits | Powered by: | Join free