Monday, November 10, 2008

Getting back your lost files with Vista

If there is one good thing about Vista compared to XP, it's the new storage stack, which is now on par with the server operating systems such as Windows Server 2003 and 2008.

I am still due to write a post about how to write image-based backup using VSS (volume snapshot services), but just now I used it to save a file that I thought I'd lost.

I was editing code in Visual Studio, hitting Ctl-S to save it every few modifications. Suddenly, a window popped us inviting me to save Program.cs to an alternate location. I cancelled out (first mistake), closed VS (second mistake), and went to the part of the tree where the file was. It was showing in the explorer, but I could not open it.

"Vista..." - I sighed, and rebooted the computer (in reality, I don't have a proof - or even reason to believe that it was Vista that ate the file - it is more likely a bug in Visual Studio that is to blame).

When it came back, the file was not there. Damn. Another reboot, but with "chkdsk /f c:" now to check the file system. No errors, and the file still not there. Luckily, I remembered about VSS and how it is now a part of the client operating system.

What is VSS, or "Volume Snapshot Services"?

It's a service in the operating system that periodically detects which clusters on the disk are used by the file system. Then, when any of these clusters is overwritten, before writing the new data, it copies the old information in an area of the disk reserved for it, and records it.

Then, the (read-only) image of the original (at the time of the snap) disk state can be reconstructed and mounted. So if the file system got corrupted, or a file overwritten or deleted, you can get your data back.

To do it, right-click on a file (if it's still present), or a folder, or a drive, and click on "Restore Previous Version..." menu item.

A dialog box will open inviting you to select from a bunch of snapshots that the system had taken for you at various times in the past:

Select the version, and the normal explorer window will open, pointing to the mounted image of your disk as it existed on the given date.

Find your file, and voila - you can copy it to where it should be.

1 comment:

Anonymous said...

According to, this feature is available on only some versions of Vista. My wife's computer runs Vista Home, so she's out of luck. Typical MS caca.