Is there a tool to copy a folder using shadow copy?

12

10

Is there a tool similar to Robocopy or TeraCopy that would do a "shadow copy" of a folder?

I'm not sure if this is technically possible on Windows 7 but what I'd like to find a utility that, when I execute the "copy" command, would create a fixed copy of that folder at that given time and then copy the result over to another location. What I'd like to achieve are consistent copies of folders that might be currently in use.

Is this possible on Windows? Is there any user friendly utility to help with this?

Borek Bernard

Posted 2012-02-26T20:15:50.790

Reputation: 11 400

What do you mean by a fixed copy? – soandos – 2012-02-26T20:17:55.327

I'm not sure which term to use but the result should be the same as if the copy was done using VSS but only on the folder-level, not disk-level. The goal is to create a consistent copy of a folder - as if the backup ran in 0.0s. – Borek Bernard – 2012-02-26T20:22:12.873

1@soandos, VSS sends out a single to all application telling them to complete any writes so what is saved on the disk is consistent, then it temporarily re-directs all new writes to a different location and makes it possible for you to mount and access anything from the shadow in that consistent state. This allows you to backup a huge amount of data without stopping any services or applications. – Zoredache – 2012-02-26T20:40:59.393

Answers

10

What I'd like to achieve are consistent copies of folders that might be currently in use.

Please understand that applications must actually be compatible with VSS. While you can create the shadow copy, it is possible the applications with in-use files may not respond to the event and do what is required to make sure you get a consistent copy.

What you almost certainly want to do is to use the Diskshadow command to create a shadow copy, and then temporarily mount it as a volume. Once you do that you can use robocopy/teracopy or favorite tool to make a copy. Here is the set of files that I use to make a backup using VSS of one of my systems. There is another example that is part of the MS docs I linked to.

shadowbackup.bat

@echo off
o:
cd \shadow
del o:\shadow\*.cab
diskshadow -s diskshadow_script.txt
robocopy /mir S:\data\ \\srv-backup\backupshare\srv01\

diskshadow_script.txt

delete shadows exposed s:
set context persistent nowriters
set verbose on
add volume o: alias Backup
create
expose %Backup% S:

Zoredache

Posted 2012-02-26T20:15:50.790

Reputation: 18 453

1Even that's not accurate: DiskShadow is only in the server versions, and the mention of Win8 is just a typo/mistake on TechNet's part. – SilverbackNet – 2015-06-16T08:27:22.807

Moreover, vssadmin can't do one very important thing that diskshadow can, namely force delete "zombie" shadow copies.

– RomanSt – 2016-06-14T22:39:48.587

If I need to copy a 5MB folder on an almost full 1TB disk, this will create another 1TB of unnecessary backup data, won't it? You're right that I'm looking for a functionality similar to VSS, but without the "volume" part. If it exists... – Borek Bernard – 2012-02-26T20:34:05.417

diskshadow is calling the VSS API. It won't take up any additional space. Or at least not much. VSS is a copy-on-write technology. So until you delete the particular shadow that you create with diskshadow any new writes to the volume will take up space, since a copy of the unchanged file, and any new writes must be saved. If space is an issue, just make sure you use diskshadows to delete the shadow volume as soon as you are done with it. – Zoredache – 2012-02-26T20:37:59.227

Ah OK I think I understand your solution now. Didn't know that you could mount a volume in a "frozen" state without actually making a full backup of it. Is there any application that would automate this for me? Like mounting the volume when copying starts and unmounting it when it finishes? I don't want to deal with VSS details myself (I don't have any experience with command-line VSS and don't want to lose data due to some incorrect command). – Borek Bernard – 2012-02-26T20:50:22.493

I am not aware of any GUI tools. – Zoredache – 2012-02-26T21:30:28.317

2

I would have down voted this, but I don't have the reputation - diskshadow is not actually a part of Windows 7, it's introduced in Windows 8 - http://technet.microsoft.com/en-us/library/cc772172.aspx. For Windows 7, you'll need to use vssadmin, which exposes the same functionality in a less convenient fashion.

– SamStephens – 2014-06-12T15:27:36.157

8

Try Hobocopy from Wangdera Tools and Utilities.

Bob M

Posted 2012-02-26T20:15:50.790

Reputation: 334

If you have the "Chocolatey" package manager installed, it can do an unattended installation of HoboCopy for you. To do this, enter the following command: chocolatey install hobocopy – unforgettableidSupportsMonica – 2015-10-13T02:52:15.383

1

For the sake of completeness as I stumbled upon this. There is also a WBAdmin tool that can backup folders on Windows 7 using VSS. See TechNet for details. It works out of the box and no 3rd party tool needs to be installed.

mlt

Posted 2012-02-26T20:15:50.790

Reputation: 261

1Unfortunately, you can only backup individual files & folders on the Server Windows, the desktop versions give an error: "A partial backup of volumes is not supported on this version of Windows." Which is bizarre because the GUI can do it, but I guess that's Microsoft. – SilverbackNet – 2015-06-16T08:21:39.610