1

Following on from my discussion with @JustinD in the comments here, is it technically possible to simply xcopy the contents of a Windows partition to a partition freshly created and formatted on a new drive, and have the copied OS boot up normally as before?

My understanding is that the MBR is located at the first sector of the drive preceding the first partition, and thus is inaccessible to xcopy. Thus even if all the files are transferred, the lack of a proper boot record on the target disk should prevent it from booting unless a Startup Repair is performed. Looking at all the programs that offer disk/partition cloning, if all that was required was a simple file copy then surely nothing more than a LiveCD/USB would be required for a successful OS transfer? Or one could just connect the new drive, xcopy the OS and then swap drives if it was that simple.

So, can one simply xcopy Windows (and the System Reserved partition, if it exists) and expect it to boot?

Karan
  • 55,947
  • 20
  • 119
  • 191

3 Answers3

6

Short answer: no.

You can, however, image (also commonly called "ghost") the drive to another. Norton Ghost, Acronis and other tools exist to accomplish this.

What does work however with Windows XP (not applicable to Vista and up) is starting the installation, letting the file copy finish. Then, delete everything the new installation created except the files in the root of the drive (boot.ini, ntldr, etc). At this point you can copy over all the files (once again, except the root) from the old installation and it will boot back up.

There are very few reasons to do this, but it works!

  • Just what I thought (and as per my own observations). But since @JustinD is absolutely *insisting* it works, I have *no* idea how he accomplished this. Imaging (such as with dd on Linux) obviously would perform a sector-wise copy and ignore the concept of individual files (which xcopy copies), and would hence copy the entire contents of the HDD including the MBR. – Karan Dec 17 '12 at 17:30
  • Admittedly, I never tried the xcopy method. – Pier-Luc Gendreau Dec 17 '12 at 17:41
  • Actually I had occasion to test this a couple of days back with Win7 and it did not boot, as expected. I'm still wondering whether there might be any situation where it will work, as apparently experienced by him. As for your edit, at that point the XP installer would have written to the MBR, so it will obviously work, but that's different from the scenario described. – Karan Dec 17 '12 at 17:43
  • Edited my answer, I suppose it could work if you recreated the MBR. Although most definitely not with Windows Vista and up. – Pier-Luc Gendreau Dec 17 '12 at 17:46
  • 1
    Yup, it's the MBR recreating that's the main sticking point here. IMO xcopy simply cannot do this, so I'm at a loss to explain it. I still think he had the previous MBR present and so it worked. – Karan Dec 17 '12 at 17:50
  • Yes, indeed. Since xcopy works with the file system it cannot work straight up with no tinkering. – Pier-Luc Gendreau Dec 17 '12 at 17:56
  • I'm thinking he failed to remove the boot loader properly, such as diskpart's clean (all) would accomplish. – Karan Dec 17 '12 at 17:58
  • Most likely this is the case, similar to the example in my answer in that the MBR was either still there or recreated. There really isn't any other logical explanation. – Pier-Luc Gendreau Dec 17 '12 at 18:01
  • BTW, you can setup the MBR with the format command using the /MBR option, assumming you can boot up somthing like DOS.....You can then use xcopy to copy the files to the destination. – mdpc Dec 17 '12 at 18:10
  • 2
    @mdpc: You'd need to use the fixboot/fixmbr commands (XP) or bootrec's fixboot, fixmbr and rebuildbcd options (Vista+). Who even uses DOS these days, plus it'll not detect newer SATA drives, won't work with NTFS anyway and its /mbr option will most likely not help with Windows or worst case even mess up an existing install. – Karan Dec 17 '12 at 22:52
  • @karan I have used xxclone when it first came out, it does the copy and fixes up the system files and the mbr stuff, works with the system up even. Similar in the respect that it is copying file items, instead of sector by sector. similar in such that the file system and or size of disk can differ. http://www.xxclone.com/itheory.htm I have used the "copy all the files" method, and it was usually dependant on the disk already being setup like your saying, XXclone did a lot the same thing, with the bootability. – Psycogeek Apr 01 '13 at 15:25
  • @Psycogeek: xxclone might work, I don't deny it, but the question was about xcopy specifically. If you were just offering an alternative, thanks, but I use other programs like Clonezilla, Acronis, Ghost, dd and so on. – Karan Apr 01 '13 at 16:56
3

For W7 and W8 (should work same) - You can definitely use xcopy in WinPE to do this - you can't do it in Windows while it is running because of file locking.

  1. Boot to WinPE and xcopy the root of C:\ to another disk.
  2. After copied, delete C:\Boot\BCD (file).
  3. Then run bcdboot C:\windows /s D:
Todd
  • 31
  • 1
  • Yes, I mentioned [above](http://superuser.com/questions/520552/can-xcopy-make-a-bootable-copy-clone-of-windows/739783#comment626450_520554) that you'd need to fix the MBR or rebuild the BCD store. Without that just using xcopy will *not* result in the copy of Windows booting. – Karan Jun 11 '14 at 21:55
  • For Windows 7, I was able to do this in a VM from one VHD to another with success. For Windows 10, I tried this with 2 actual drives and the copy was not usable. It did boot to safe mode, but there were clearly "weird issues" that prevented the system from being usable. – curlyhairedgenius Mar 04 '19 at 15:27
0

In dos mode and in cmd in winxp works just fine! Order of operations: 1. Xcopy source destination switches (/? for help) 2. Boot from a bootable windows cd or usb and enter in a cmd window and give the command sys [drive letter of primary partition] to make it system and bootable. All done! If the partition is active and unhidden(case of recovery partition) it will boot.

Alex
  • 1