Hello
I am trying to create a Net 5.0 application for Hyper-v Backup and I would like to use Resilient Change Tracking for backup virtual disk's Blocks changing.
I am using a Wrapper to library VirtDisk.h (https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/) from C# to access Win32 Resilient Change Tracking functions and also I am testing with Windows server 2016 version 1607 with Hyper-v version 8.0, by default when I create a virtual machine Resilient Change Tracking is disabled, so I have to enable it, but never gets activated.
The test hyper-v host machine (Windows server 2016) is a single server and is not in a cluster.
To activate Resilient Change Tracking through VirtDisk.h, I am calling the function SetVirtualDiskInformation:
[DllImport("VirtDisk.h", CharSet = CharSet.Unicode)]
public static Win32Error SetVirtualDiskInformation(VIRTUAL_DISK_HANDLE VirtualDiskHandle, in SET_VIRTUAL_DISK_INFO VirtualDiskInfo);
VIRTUAL_DISK_HANDLE is a pointer (SafeHandler) to a VirtualDisk that was obtained by calling the OpenVirtualDisk method of the VirtDisk.h
[DllImport("VirtDisk.h", CharSet = CharSet.Unicode)]
public static Win32Error OpenVirtualDisk(in VIRTUAL_STORAGE_TYPE VirtualStorageType, string Path, VIRTUAL_DISK_ACCESS_MASK VirtualDiskAccessMask, OPEN_VIRTUAL_DISK_FLAG Flags, OPEN_VIRTUAL_DISK_PARAMETERS Parameters, out SafeVIRTUAL_DISK_HANDLE Handle);
Code to open virtual disk:
string vhdxPath = @"A:\VirtualMachine\VirtualDisk.vhdx";
OPEN_VIRTUAL_DISK_PARAMETERS parameters = new OPEN_VIRTUAL_DISK_PARAMETERS(1)
{
Version = OPEN_VIRTUAL_DISK_VERSION.OPEN_VIRTUAL_DISK_VERSION_1,
};
parameters.Version1.RWDepth = 1;
var vhd = VirtualDisk.Open(vhdxPath, OPEN_VIRTUAL_DISK_FLAG.OPEN_VIRTUAL_DISK_FLAG_NONE, parameters, VIRTUAL_DISK_ACCESS_MASK.VIRTUAL_DISK_ACCESS_ALL);
VIRTUAL_DISK_HANDLE is a pointer that is obtained without problems and I can access the virtual disk information through all the functions of VirtDisk.h, however when I try to activate Resilient Change Tracking with the following code, it never works
var si = new SET_VIRTUAL_DISK_INFO { Version = SET_VIRTUAL_DISK_INFO_VERSION.SET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE, ChangeTrackingEnabled = true };
var result = SetVirtualDiskInformation(Handle, si);
result.ThrowIfFailed();
Finally, I validate the ChangeTrackingEnabled property after activating it and it always has a false value, also the files with the .rct extension are never generated.
I wonder if there is another way or example code or documentation for activate Resilient Change Tracking inside a virtual machine?
NOTE: I tried activate Resilient Change Tracking using powershell with the command Update-VMVersion and I get the following message;
> WARNING: No update was performed for the virtual machine "MVWinRctTest" because its configuration version is already at the maximum level supported by this server. For clustered servers, the maximum supported configuration version can be limited by the cluster functional level.
Any thoughts will be greatly appreciated.
Best