I'm manually backing up data off a hard drive that has XP installed on it, because I suspect the drive is failing. I want to copy the files, but I don't want to change the owner (or any permissions) on the original drive, to be able to do so. Is there any way to do this?


Turns out Robocopy can do this incredibly easily. Simply include the /B option on your command line, to copy files in Backup mode. This requires that you run as Administrator.

My command line:

robocopy /MIR /B "E:\Documents and Settings" "C:\DeadDriveBackup\Documents and Settings"
  • That's exactly the way. Some backup tools can also do this, but robocopy is the simplest option. – Angstrom Dec 3 '13 at 8:04
  • /COPYALL option is useful if you need the exact same permissions on the target files/directories. – Rockallite Feb 27 '18 at 9:26

The given answer did not work for me; this did.

Robocopy has a /COPY argument used to specify which parts of files to copy. Available to copy are data, attributes, timestamps, security information (NTFS ACLs), ownership information, and auditing information. If you're looking to copy everything in one directory to another perfectly, use this:

robocopy /E /B /COPYALL "C:\One" "C:\Two"

Let's analyse:

  • /E copies all files, including empty directories. This works like /MIR, but doesn't delete anything in the destination.
  • /B copies in "backup mode", giving Robocopy the permission to overwrite ACLs (file permissions).
  • /COPYALL is an alias to /COPY:DATSOU, which copies all file data, including file ownership and permission (ACL) data.

Are you copying a user profile?

I was, and there are some extra caveats. Default Windows user profiles contain directory junction loops, and Robocopy cannot be configured to create new junctions rather than following them. The above Robocopy command will fail and create difficult-to-remove directory trees, so use this command which will exclude junctions.

robocopy /E /B /COPYALL /XJ "C:\One" "C:\Two"

For compatibility you should probably recreate the default directory junctions in a user profile:

mklink /J "Application Data" "AppData\Roaming"
mklink /J "Cookies" "AppData\Local\Microsoft\Windows\INetCookies"
mklink /J "Local Settings" "AppData\Local"
mklink /J "My Documents" "Documents"
mklink /J "NetHood" "AppData\Roaming\Microsoft\Windows\Network Shortcuts"
mklink /J "PrintHood" "AppData\Roaming\Microsoft\Windows\Printer Shortcuts"
mklink /J "Recent" "AppData\Roaming\Microsoft\Windows\Recent"
mklink /J "SendTo" "AppData\Roaming\Microsoft\Windows\SendTo"
mklink /J "Start Menu" "AppData\Roaming\Microsoft\Windows\Start Menu"
mklink /J "Templates" "AppData\Roaming\Microsoft\Windows\Templates"
attrib /L +S +H +I "Application Data"
attrib /L +S +H +I "Cookies"
attrib /L +S +H +I "Local Settings"
attrib /L +S +H +I "My Documents"
attrib /L +S +H +I "NetHood"
attrib /L +S +H +I "PrintHood"
attrib /L +S +H +I "Recent"
attrib /L +S +H +I "SendTo"
attrib /L +S +H +I "Start Menu"
attrib /L +S +H +I "Templates"

I would boot a live CD like Parted Magic and use something like GNU ddrescue to image the drive.

If you really only want some of the files, you can always copy just the files you want - by default NTFS partitions should be mounted read-only, so there's no possibility to accidentally change anything.

  • Good advice. I typically boot to Clonezilla for making hard drive images. In this case though, I only have the hard drive, connected via a USB2 external adapter. – Jonathon Reinhart Dec 3 '13 at 4:10
  • If a drive could be failing it's usually a bad idea to write anything to it - I think Windows does this automatically (at least, Windows XP used to do things like leaving thumbs.db files everywhere, I don't know what kind of caches 7 or 8 uses). I'm not sure exactly how to tell Windows to mount a newly-connected USB drive read-only, so I tend to avoid it when dealing with suspect drives. (Also, I think the error messages tend to be less informative, and distros like Clonezilla and Parted Magic tend to have better built-in tools...) – user55325 Dec 3 '13 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.