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

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.


Feedback

# Link Listing - December 7, 2006

Cool SharePoint Tool: SharePoint Inspector [Via: jantie ] Howto: Use a Vista DVD to duplicate any Windows... 12/7/2006 11:59 PM | Christopher Steen

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I just did this for copying an existing vista installtion as well, it worked like a charm, it sure beats messing with the various partition tools. I noticed Vista has built-in support for "image" based installs, which it uses, however I couldn't find any program called imagex or ximage command line tool on my vista installation. It would be neat to take a back-up of your system as an image (like ghost) then reimage on top of new drive, etc... like the ultimate backup.

Thanks for the great article. 2/20/2007 5:27 PM | lucas

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I am sorry, but I attempted to use ROBOCOPY as suggested and it ended up creating files more than 3 times the size of the original. Even worse, the files that were copied appear to the OS as the same size as the originals when queried with DIR.

I used the command exactly the same as in the article (apart from the necessary drive letter change). ROBOCOPY, didn't complain (apart from running out of space), and didn't give any warning of impending doom.

I probably did something wrong, but if it's possible to make so much mess without any warning, I have to regard ROBOCOPY as dangerous to use in the situation suggested.

I attach info :-

ROBOCOPY was run from a Vista Ultimate installation disk.

ROBOCOPY Command used ROBOCOPY K:\ C:\ /e /efsraw /copyall /dcopy:t /r:0

C: (Source Disk)

Used Space: 13,526,593,536 bytes 12.5GB
Free Space: 40,160,493,568 bytes 37.4GB

Properties Info for all Files on disk C: (Source Disk)

69,384 Files, 12084 Folders
Size: 15.0 GB (16,186,046,656 bytes)
Size on disk: 15.1 GB (16,301,797,376 bytes)


K: (Target Disk)

Used Space: 42,945,474,560 bytes 39.9GB
Free Space: 4,194,304 bytes 4.00MB

Properties Info for all Files on disk K: (Target Disk RobCopy copied to)

56,118 Files, 12084 Folders (Disk had run out of space)
Size: 10.0 GB (10,820,800,267 bytes)
Size on disk: 10.1 GB (10,933,432,320 bytes)



E:\Documents and Settings\Administrator>chkdsk c:
The type of the file system is NTFS.

WARNING! F parameter not specified.
Running CHKDSK in read-only mode.

CHKDSK is verifying files (stage 1 of 3)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 3)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.
CHKDSK is verifying Usn Journal...
Usn Journal verification completed.
Correcting errors in the uppercase file.
Windows found problems with the file system.
Run CHKDSK with the /F (fix) option to correct these.

52428799 KB total disk space.
13008564 KB in 54543 files.
31832 KB in 12144 indexes.
0 KB in bad sectors.
169171 KB in use by the system.
65536 KB occupied by the log file.
39219232 KB available on disk.

4096 bytes in each allocation unit.
13107199 total allocation units on disk.
9804808 allocation units available on disk.

E:\Documents and Settings\Administrator>chkdsk k:
The type of the file system is NTFS.
Volume label is Vista Copy.

WARNING! F parameter not specified.
Running CHKDSK in read-only mode.

CHKDSK is verifying files (stage 1 of 3)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 3)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.
Correcting errors in the uppercase file.
Windows found problems with the file system.
Run CHKDSK with the /F (fix) option to correct these.

41943039 KB total disk space.
40604120 KB in 849107 files.
373060 KB in 45192 indexes.
0 KB in bad sectors.
961763 KB in use by the system.
65536 KB occupied by the log file.
4096 KB available on disk.

4096 bytes in each allocation unit.
10485759 total allocation units on disk.
1024 allocation units available on disk.


2/22/2007 6:56 AM | Tony Formoso

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Good article, but I have the same problem as Tony. It would seem to follow directory shortcuts and copy the data inside. This creates a kind of infinite loop. Shouldn't it just copy the shortcut?

Any help out there? 2/23/2007 6:08 PM | Andrew Gallagher

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I tried this with a vista disk and vista installation. Everything worked fine until the robocopy portion. It "worked" but skipped the directory and didn't copy anything. 3/16/2007 8:13 PM | Robert

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Funny Windows people. I can do this on any Mac OS X machine in about 5 different ways with either built-in tools or common freeware. And it's all drag-and-drop. 3/20/2007 10:37 AM | Marc

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Funny Mac people. I can do this on any Linux (or UNIX) machine with a simple "cp -aR" without dragging or dropping anything :) 3/23/2007 1:27 PM | djibla

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I am currently robocopying a vista install to a new faster hard drive. All appears to be going well, but one file was not copied:
hiberfil.sys
don't know why or if will be a problem 3/29/2007 7:07 AM | Ron Hickman

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Ron,

This is the hibernation file. All it means is that you'll have to re-enable
hibernation when you boot to the new disk.

Tony and Andrew,

I wonder if this has to do with the many hidden junction points ("soft links") that are found under the Users folder. Each profile has several of these in order to maintain backwards compatibility. Hmmm... 3/29/2007 8:15 AM | Lorin Thwaits

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Where can I get a copy of Vista DVD? Is it for free? Thanks 4/27/2007 12:15 PM | Jack

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I believe that the /XJ switch to Robocopy will solve the problem people were having with the destination being much larger then the original. This turns off the copying of "junction points" which are similar to unix links for directories.
6/18/2007 3:32 PM | Sean

# m566z

lo719l 6/26/2007 3:57 AM | ro767ck

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Just finished doing this with a Vista install, from a 40GB to a 160GB HD. Worked a treat, though I had to Repair the Vista install to correct a 'startup configuration' issue.

Brilliant stuff though - saved a lot of messing around with Ghost and what not. Cheers! 6/28/2007 3:34 PM | mroshaw

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I can confirm that using the /XJ switch in Robocopy resolves the issue with the space used, when moving a Vista installation across discs! 7/2/2007 5:16 AM | mroshaw

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

For weeks now I have been looking for a solution to move my Vista installation from one partition to another. This worked perfectly, including the /XJ switch.

One thing that I think you should clarify is about DISKPART. I didn't realize it was actually a program that must be run without any additional commands. I kept typing "diskpart list disk," "diskpart /list disk," or "diskpart /?" 7/13/2007 3:35 PM | Dan

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

For weeks now I have been looking for a solution to move my Vista installation from one partition to another. This worked perfectly, including the /XJ switch.

One thing that I think you should clarify is about DISKPART. I didn't realize it was actually a program that must be run without any additional commands. I kept typing "diskpart list disk," "diskpart /list disk," or "diskpart /?" 7/13/2007 3:35 PM | Dan

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Seemdd to work however 15 files failed to copy over which resulted in the user profile not being found when started 7/26/2007 3:46 AM | Mike

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I'm curious about whether this approach could be used to copy a standard XP (or Vista) image from one PC to several others that use the same hardware. 9/20/2007 9:42 AM | Wil

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

I have only found one reliable way to duplicate/clone a Vista installation.
Acronis True Image Home V11.
Works perfectly, only requires reactivation on the new hard drive. One phone call, no big deal.
You get a free 15 day trial of the full version, you only need about 1 hour.
10/25/2007 2:09 AM | Geoff

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Clonzilla Live is a GREAT open source (FREE) option for imaging practically any OS. I've tried many imaging tools and this one seems to be much quicker than most.

http://clonezilla.sourceforge.net/



And here is a link to the forum, where the developer is very quick to help you with problems:

http://sourceforge.net/forum/forum.php?forum_id=663168 12/16/2007 1:39 PM | Stevo

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

You may have saved my bacon with this post.

After discovering a SMART error on my 250GB hard disk on a Dell laptop I made a Complete PC Backup using Vista. I dual boot XP and Vista.

After having the drive replaced under warranty I found myself unable to restore the backups. Vista wiped existing partitions, created new blank partitions then complained that one of the files in the backup is corrupt.

I don't use Vista much as I hate the buggy piece of garbage but my XP partition has taken me months to install all the software I use. So I didn't want to give up on it.

I used Microsoft Virtual Server to mount the VHD images created by vista backup.

The command I used was something like
mount /m F:\backup\blah.vhd
but the I don't have the exact filename I used.

My intial attempt to copy from this didn't go well. I was using an XP version of Robocopy, and not using switches that allow security/encryption to be copied so I was having all kinds of problems with file permissions, ownership and encryption.

Then I came across your article and tried again.

Once I had the drive mounted as H: I used the following command:
C:\WINDOWS\SYSTEM32\ROBOCOPY H:\ D:\ /e /z /efsraw /copyall /dcopy:t /r:0 /XJ /LOG+:C:\robocopyIt.log /tee /XD "H:\System Volume Information" H:\$RECYCLE.BIN

This is a combination of the command you suggested, the /XJ switch someone posted above, and the standard switches I'm use to using with robocopy.

It's looking good. No errors copying so far, and I'm very hopeful. I'll let this go overnight, but if I don't post back you can safely assume my XP partition was restored successfully.

I hope my post saves someone else's bacon.
2/1/2008 12:13 AM | Sammy

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Hello,

it worked fine. I used the /XJ switch.
4 files were not copied. I had to repair the vista installation which took about 1 min.

Outlook could not send/receive. I had to run the repair of the office install. Probably one of the files that was not copied caused the error.

I have not yet read through the logs..

BR,
Max 3/5/2008 7:12 PM | MaxZ

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Although not free, Ghost is a great tool, easy to use, and works flawlessly.

I've used it for years in a professional software testing environment to restore machines to clean states, transfer to other machines, and upgrading my hard drives at home. 3/17/2008 3:12 PM | Jason

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

Great source of useful info. I managed a copy of an XP Pro installation to another drive and it worked beautifully. BUT, I tried the same thing with a Vista installation and robocopy stopped because it would not copy the file hiberfil.sys. I haven't been able to around this. Anyone know the answer? Thanks. 4/22/2008 10:16 AM | Rodders

# re: Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!)

The robocopy worked fine.
Then fix the boot issue also worked fine.
I get to the point where Vista shows the login names.
When I click a name and enter the correct password I get an error and can't login.
Suggestions anyone?

Thanks,

Jan 7/4/2008 3:22 AM | Jan Boen

Post a comment





 

Please add 1 and 3 and type the answer here:

News


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

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Syndication: