It doesn't happen often that I have to use System Restore to restore 
to an earlier restore point, but it has happened.  Last time it happened
 on a virtual machine that had a Blue Screen of Death all of a sudden in
 the middle of a development project.  It wouldn't come back up and I 
was in a hurry and used the "System check - recover" option or whatever 
it is called on the windows startup screen.  It didn't indicate system 
restore so I let it run.  Once it was done and Win7 was back up and 
running there was a message stating something to the effect that the 
computer had been rolled back to the last restore point - which was from
 the night before.
I checked my apps and lo and behold, they were all from the night 
before.  So were a couple of external .clw files.  Fortunately I had 
just placed the project into version control and even later, uploaded it
 to my client's FTP server so I had a copy from about an hour before the
 BSoD happened. 
I decided to take a good look at how to prevent this from ever 
happening again.  I have all my projects backed up and also in version 
control (which is also backed up) so I'm not at much risk of losing work
 (I HATE losing work, so I do my best never to have that happen to me!) 
 After snooping around on the web I found several references and they 
all pointed in the same direction.
In the registry there are two keys that control the System Restore:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot
The first one affects backup and the second one affects the Volume Shadow Services (VSS), which is the technology that System Restore uses to create the snapshots, i.e. the restore points. To be on the safe side, I have modified both of them to exclude my development folders and also specifically the .app and .clw files.
Here is what I use right now:
C:\dev\* /s
C:\*.app /s
C:\*.clw /s
C:\Clarion\* /s
I create a multi-string value in those two keys, call the value "Clarion" and put those lines into the value data text box. If you want to include a folder you use the path and then \* If you want it to be recursive and contain sub-folders you add the /s switch to it. You can exclude files and folders and groom this as you like. Basically this works like the good old DIR command in DOS, for those of you old enough to remember DOS
 For those of you who don't, run cmd.exe and try dir /? in the root of your C drive and then play with it. I think the only switch available to the exclusions is the /s switch.
All my current development is in the C:\dev folder. But I also have a lot of older apps and stuff in my C:\Clarion folder so I want to exclude both of those. I also set the *.app and *.clw to be excluded 
anywhere on the C: drive. 
If you have a second drive for your development you can simply turn 
System Restore off for the drive, but if you have it on the C: drive, 
then you need to prevent System Restore from messing with your files!  
I'm always running out of drives - I have 5 drives currently hooked up 
to my development machine, with a total of 6 Terabytes of storage!  If 
you are like me and you use virtual machines a lot for development, 
remember that they also have system restore active and you need to take 
care of those machines as well, just like any other physical machine.
There is nothing like having to use System Restore to recover from a 
botched Windows update (has happened to me 2 or 3 times in the past) and
 then realize weeks later that bugs you had fixed have crept back in!  
Backups and rigorous version control are the only things that can save 
you from things like that!  And make sure that your version control 
folders and files are not included in system restore backup on the 
version control server or you may be in for a nasty surprise if System 
Restore decides to restore it to what it was 6 months ago!!!
Hopefully this will help some of you to avoid disasters.  If you have
 additional information, please comment or let me know directly. 
____________________________________________
-MEHUL PATEL - http://www.FB.com/GujaratiKanudo
-MEHUL PATEL - http://www.FB.com/GujaratiKanudo

No comments:
Post a Comment