Thursday, October 21, 2010

Fun with VSS

I get this call today, "Hey man, I did some stuff last night to some files. Can you take a full backup from around 9PM, just before I started, in case we need to pull something back?"

Now to protect the innocent, he knew we had VSS snapshots going so its not as bad as it seems... or is it? I poked around for awhile but didn't see anything in NetBackup that would allow me to target a specific VSS snapshot for a full backup. I started thinking; "sure, let me get in the hot tub time machine and knock that out!" But after a few searches later (maybe some of the same that brought you here) it was pretty straight forward to go back in time after all.

We start off with with finding a list of our shadows. We want to find the corresponding entry to the "Shadow Copy Volume" of the date/time we're looking for. It looks something like

E:\>vssadmin list shadows /for=e:

Contents of shadow copy set ID: {7f35f0eb-f654-47b2-9ec4-0be0b4d285bb}

Contained 1 shadow copies at creation time: 10/20/2010 9:00:21 PM

Shadow Copy ID: {00dc1abc-480c-47fe-8f70-2e1ee2c969ff}

Original Volume: (E:)\\?\Volume{31cb9b20-d098-11df-9830-00505688000d}\

Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy534

Originating Machine: ******

Service Machine: ******

Provider: 'Microsoft Software Shadow Copy provider 1.0'

Type: ClientAccessible

Attributes: Persistent, Client-accessible, No auto release, No writers,


Next, we want to make a link to the shadow copy.

E:\>mklink /d e:\10_20_2010_2100hrs \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy534\

symbolic link created for e:\10_20_2010_2100hrs <<===>> \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy534\


Volume in drive E is corp

Volume Serial Number is E847-3199

Directory of E:\

10/21/2010 06:13 PM 10_20_2010_2100hrs [\\?\GLOBALROOT\Device


0 File(s) 0 bytes

10 Dir(s) 266,310,508,544 bytes free

Now we can point our backup solution to the specific folder within our snapshot that we want to archive for that rainy day. As a side affect, this seems to elegantly solve an issue doing backups on DFS shares (which this is), and allows for much easier restores. We'll post a follow on and cover that soon. Stay tuned!


No comments:

Post a Comment