Reloading volume shadows and canceling failed shadows

Jan 13, 2011 at 3:58 PM

Two questions:

1.) Can you load a volume that is already created?  If so, how?

2.) Can you cancel a failed attempt so another attempt can be made.  If there's an error starting the volume, I get stuck at "Volume creation already in progress."  Is there a way around that?

 

Thanks for this library, it's saved me a lot of headache already.

-Ray Phillips

----------------------------------------------------------------------

Jeffcomputers.com

StudyX.com - Easy to use study software with games, flash cards, printable tests, and more!

Coordinator
Jan 22, 2011 at 11:22 AM

1.) What do you mean by "loading" a volume?

2.) Unfortunately I don't have a good answer here, maybe someone else has an idea?

Jan 22, 2011 at 4:44 PM

Basically, the problem I'm having is this:

On XP, you can only create one volume shadow at a time.  This works fine most of the time, but if the program crashes before stopping the volume shadow, the user either has to restart the computer or wait for more than 20 minutes to try again otherwise you get an exception saying that the maximum number of volumes has been created.  I was curious if there is some way to either access the previously completed volume shadow or stop it so I can create another.

The other question had to do with errors that occur while creating a volume.  While I was first developing the VSS implementation, I had a line of code that caused the program to crash.  If this happened, I had to restart the computer to try again, otherwise I received "Volume creation already in progress" or something similar.  Is there a way to halt the volume being created (because creation failed, it will never finish) so I can try again?

I think I may have found a solution to the first problem, at least for XP.  Win7 doesn't like it, but Win7 can create more than one Volume Shadow, so it works out.  But I'm still struggling with the second problem.

Thanks for the reply.

-Ray Philllips

----------------------------------------------------------------------

Jeffcomputers.com

StudyX.com - Easy to use study software with games, flash cards, printable tests, and more!

Coordinator
Jan 22, 2011 at 6:34 PM

Ah, now I understand your problem. Have encountered this a few times myself when developing and testing. Not aware of any method to programatically acheive this though. But there is at least a process called VSSVC.exe which you can kill using task manager to avoid having to restart your computer if this occurs. At least this worked for me when I encountered this problem.

Regards, Peter.

Feb 16, 2011 at 5:55 PM

On windows xp vshadow.exe has an option (-da) which can delete all snapshots. I've used it for cleaning up after crashes. There should be a way to delete all snapshots via code, it's just a matter of figuring out how vshadow.exe is doing it and if the necessary functionality exists in AlphaVSS.

[On my system]

C:\Program Files\Microsoft\VSSSDK72\TestApps\vshadow\src\delete.cpp

Feb 16, 2011 at 6:36 PM
Edited Feb 16, 2011 at 8:54 PM

This seems to replicate the functionality of vshadow -da:

 

using (IVssBackupComponents vss = vssImp.CreateVssBackupComponents()) {
	vss.InitializeForBackup(null);

	foreach(VssSnapshotProperties vssProps in vss.QuerySnapshots()) {
		vss.DeleteSnapshot(vssProps.SnapshotId, true);
	}
}

 

There is a method of IVssImplementation called IsVolumeSnapshotted() that may be of use to others.

 

-- edit --

The code above works fine on windows xp however I'm not sure of the implications of blindly deleting all snapshots on any system. I'm thinking that the GUID used in the initial snapshot needs to be stored and in effort to clean up a bad ending, the loop through the snapshots should look for the previously used GUID and not delete anything else. Any thoughts on this?