-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Howdy, I've been using AlphaVSS for a few months now, and using AppRollback context, and wanted to change to using NasRollBack context, as I believe this will give me a snapshot set in a read only state, where the files won't update on the snapshot.ExposedName after I take the initial snapshot, and then I can start backing up the files to another drive on the system with a point in time recovery model.
- Hopefully, that makes sense, and is true.
After trying to use a NasRollback context in the provider, I started getting an error suggesting I've done something wrong.
Error after runnig PrepareForBackup()
VssBadStateException: The VSS object was in an incorrect state for the requested operation.
at Alphaleonis.Win32.Vss.VssBackupComponents.PrepareForBackup() in C:\Repos\AlphaVSS\src\AlphaVSS.Platform\VssBackupComponents.cpp:line 518
In troubleshooting this, I started looking at the ComponentMode and the various components.
my code is based off of your great samples...
https://github.com/alphaleonis/AlphaVSS-Samples/blob/develop/src/VssBackup/VssBackup.cs
Python code:
import alphavss # a python class that I've wrapped the python .NET code for AlphaVSS in
# AppRollback works, and NasRollback doesn't work
# provider = alphavss.VSSProvider(operation='backup', context=alphavss.constants.AppRollback, debug=True)
provider = alphavss.VSSProvider(operation='backup', context=alphavss.constants.NasRollback, debug=True)
cmp = provider.create_backup_components() # function I encapsulated your methods into
cmp.InitializeForBackup(None)
cmp.GatherWriterMetadata()
for writer in cmp.WriterMetadata:
print(writer.WriterName)
for component in writer.Components:
print("\t", component.ComponentName)
for filedescriptor in component.Files:
print(f'\t\tpath: {filedescriptor.Path} -- FileSpecification: {filedescriptor.FileSpecification}')
In this exercise, I think I've found the problem (maybe), and wanted to ask if you might see if I am going in the right direction or not.
Namely the ASR writer includes data for every volume in my system and the 3 hard drives (of which, I am excluding one drive and one volume from the snapshot operation because I am copying the C, D and F drives to the G drive in my code):
# snippet of output from for loop above:
ASR Writer
ASR
Volume{guid1}
Volume{guid2}
Volume{guid3}
Volume{guid4}
Volume{guid5} < --- G Drive
harddisk5
harddisk0
harddisk6 < --- G Drive
BCD
path: \\?\Volume{guid1}\Boot -- FileSpecification: *.*
I'm assuming that I need to set ComponentMode = True and exclude "harddisk6" and "Volume{guid5}" from the components I want to enable in order to enable NasRollback context since I don't want to make a complete backup of the system, and exclude the G Drive in this process.
If all this is correct, it looks like I am adding code to "Examine Components" that I need and exclude the volumes/drives I am not including in the backup set via:.
cmp.AddComponent(
instanceId,
writerId,
componentType,
logicalPath,
componentName,
)
Docstring: Void AddComponent(System.Guid, System.Guid, Alphaleonis.Win32.Vss.VssComponentType, System.String, System.String)
Thanks for the long read. And Thanks for the .NET code that makes sense of all this so I could try to port this to Python.NET!
Please let me know if I am on the right track. :)
Steven