PDA

View Full Version : Shadow Copy Storage


Keef
1st Aug 2009, 23:18
I've been reading through that wonderful best-seller, the Event Log, now that the machine is back to working more or less as it should after last week's joy of "all folders locked, and you're not allowed in there, peasant!"

There is some wondrous stuff in the Event Log, showing just how abstruse Windows 7 can be when you get into the realms of who owns which drive/partition/folder and who can do what to it - after it's all gone wrong.

I've sorted most of that, and it's down to 3 or 4 "Red errors" a day now. Some of those are of the "where's my Jepp datacard writer gone?" type - the device is back in its box on the shelf till next month. No issue.

But occasionally it will spawn a load along the lines of "shadow copy storage is full" or "cannot be accessed" or "is trying to shadow itself and has a headache". I think shadow copy storage is a sort of "roll back file changes" facility, but ...

question for the wise of PPRuNe...

... should I bother to use shadow copy storage, or is it a waste of space and time?

I've found where to switch it on and off.

Jofm5
2nd Aug 2009, 01:38
Keef, whether you want or need shadow copying can be judged upon how you do your backups.

Background:

When you open a file for read/write access a lock will be placed on that file to indicate that it is in use, Windows as an operating system will enforce the lock on that file so other applications will not be able to do "dirty" reads and writes. Typically modern applications running on windows will only lock the file for the duration of the write process so it can seem pretty flexible in most respects but this is entirely a development decision and requires extra work.

On other operating systems such as Unix/Linux the situation is reversed in that you can request a lock on the file (or indeed portion of a file on some OS's) and perform your write but it is down to the application and not the operating system to observe the locks in place. This is quite useful as you can cat a text file as it is being written to (e.g. a log file) to monitor its progress in real time (on windows it would not be able to open the log file till its shut).

Shadow copy attempts to get around this and was designed with 24/7 servers in mind for backups. What the service does is mirror portions of the file system so that realtime snapshots can be taken by the OS and a full backup can be performed even whilst a file is open.

So if you close everything of use before you do a backup then it is not an issue to have shadow copy turned off - if like me you leave your computer running 24/7 shadow copy can be useful to ensure even open documents are backed up so long as your backup software is shadow copy aware.

If you wish to reconfigure your shadow copy capabilities you can run a dos prompt in administrative mode and use the vssadmin console application.

Cheers

Jof
p.s. wikipedia has a good page on this:- Shadow Copy - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Shadow_Copy)

bnt
2nd Aug 2009, 02:05
You're basically right about Shadow Copy: when you write changes to a file, Shadow Copy saves the disk blocks from before the change, and so you get the ability to roll back changes via the "Previous Versions" tab on a file or directory's Properties.

Whether or not you want to do that depends, of course, whether you want that feature. If you don't, then it's just a drain on resources (extra disk writes with every change). The "filling up" is going to happen if files get lot of changes, and/or disk space is tight. If you look up the specific error codes at Microsoft Support you may find more info.

Keef
2nd Aug 2009, 08:56
Thanks for that!

I'm doing an experiment. I've turned it on for all drives (the data ones). Windows 7 had turned it on only for drive C, the programs drive. I'll see if I get lots more VSS errors this week.

Backup is totally automated - a DOS batchfile that creates a dated folder on the external HD and copies everything important to there. It does it while I'm asleep, early on Sunday mornings. Shadows shouldn't be needed for that.

bnt
2nd Aug 2009, 22:21
A bit more detail for anyone who's interested; I used to work with large disk storage systems that used similar principles to Microsoft's Shadow Copy service, and became a bit too familiar with the limitations of the technology. (No, they didn't invent it - the generic term is Snapshot (http://en.wikipedia.org/wiki/Snapshot_%28computer_storage%29) - though some of the stuff "on top" is different. IIRC it was a VMS innovation.) The Wikipedia article on Shadow Copy is horrid, and doesn't properly cover the underlying Snapshot technology.

Basically, a Snapshot is an event that gets triggered, manually or automatically (by a program or a timer) etc., which appears to duplicate a disk at a point in time. You get two disks (block devices) where you originally had one: the original, which you continue to use as normal, and the "point-in-time" copy or Snapshot. The latter appears frozen at the exact time the snapshot was triggered, and it is thus safer to back it up, since you know nothing will change during that process.

When the Snapshot is triggered, only the first few blocks of the disk (the boot record, FAT etc.) are copied, so it's a quick process. It does not duplicate any data at that time. The key to Snapshots are what happens afterwards - the "copy out" of old data I described in my earlier post. The Snapshot system (e.g. Shadow Copy Service) keeps track of which disk blocks are original and which are modified. It watches out for disk writes, and if original data (from before the Snapshot only) is about to get overwritten, it is "copied out" and safeguarded. After that, read requests to the disk go to the new data as normal, but requests to those blocks on the Snapshot are redirected to the blocks that were "copied out". The "overhead" imposed by the Snapshot depends on how much data is changed on the original disk.

One point of confusion in that Wikipedia article is that it claims that Shadow Copy is a solution to the problem of backing up open files. It can be ... but only if the files are closed (or at least in a sensible state) at the instant the Snapshot is taken. On a Windows Server running SQL Server, for example, you get something like this happening:
- you tell a backup program "back up that database".
- the backup program tells Shadow Copy "make me a Snapshot of this disk" (holding the database file);
- Shadow Copy tells SQL Server "quiesce your database" (write all data from memory and close the file).
- SQL Server does that (delaying database requests), and tells Shadow Copy when it's done;
- Shadow Copy creates the Snapshot (a few seconds) and tells SQL Server when it's done;
- SQL Server re-opens the file and carries on servicing requests;
- Shadow Copy tells the backup program the disk ID of the Snapshot, so it can start the backup.

My point is that Shadow Copy (or an Snapshot system) is not magic, and doesn't solve the open file backup problem by itself, but it can work with other programs or services to co-ordinate its actions. The Snapshot itself is dumb: it will be a snapshot of whatever was happening on disk at the time, files open or closed. I don't know whether e.g. Word or Excel can work with Shadow Copy in that way, but it would be a good idea, since they can be a bit messy with temp files etc. when in use.

Jofm5
2nd Aug 2009, 23:44
bnt:

Your correct in that MS did not invent it, we used a similar service back in the NT 3.51 days which I cant recall the name but get an inkling it was something called dragon or similar (It was when I was working for Sony R&D about 15 years ago on a newsroom system).

I will have to dig out my notes for my masters (a few years ago) where we looked into different file systems and how shadow copying worked - but IIRC when MS bought the technology they included it in at a Kernel level so that you did not have to close the files - again I could be wrong but will try dig out my books tomorrow.

With regard to Office products they will only lock the files for the duration of the write - however if two or more people open the same file then it is defaulted to read only mode - I believe in the options for the various applications you can specify a permanent lock when open (textpad also has a similar config option).

I think the key thing which we have both pointed out is that unless you are using a shadow copy aware backup application there is no benefit in utilising the features of shadow copy and indeed it just adds uneccessary overhead.

Mike-Bracknell
4th Aug 2009, 00:13
It's a lifesaving (and timesaving) addition to a regular backup routine from a server perspective :ok: