Community

Subscribe
Highlighted
Accepted Solution

Error using Invoke-NaVirtualDiskSpaceReclaim on Server 2012 VHD & VHDX OS file

Hello good people,

I was hoping someone could help me with an error i'm seeing when using the Invoke-NaVirtualDiskSpaceReclaim on a Server 2012 VHD & VHDX. The cmdlet works on other VHD / VHDX files and this is the first time i've come across this error after using it on many servers and connecting to the controller as root with toolkit version 3.0:

PS D:\> Invoke-NaVirtualDiskSpaceReclaim "D:\HardDisk-01.vhd" -Verbose

Reclaiming free space on virtual disk

Are you sure you want to reclaim free space on virtual disk D:\HardDisk-01.vhd?

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): y

VERBOSE: Making a copy of the virtual disk.

VERBOSE: Attaching the virtual disk to the host

VERBOSE: Connecting to VDS

VERBOSE: Getting VHD provider

VERBOSE: Attaching VHD

VERBOSE: Getting volume details

VERBOSE: Getting user privileges

Invoke-NaVirtualDiskSpaceReclaim : CreateFile (open existing) failed

    + CategoryInfo          : InvalidOperation: (Smiley Happy [Invoke-NaVirtualDiskSpaceReclaim], Exception

    + FullyQualifiedErrorId : VhdDeleteFailed,DataONTAP.PowerShell.SDK.Cmdlets.HyperV.InvokeNaVirtualDiskSpaceReclaim

VDisk successfully attached, but cannot be located

   + CategoryInfo          : InvalidOperation: (Smiley Happy [Invoke-NaVirtualDiskSpaceReclaim], Exception

    + FullyQualifiedErrorId : VdiskAttachFailed,DataONTAP.PowerShell.SDK.Cmdlets.HyperV.InvokeNaVirtualDiskSpaceReclaim

This is the result from running the get alignment:

[PS D:\ > Get-NaVirtualDiskAlignment "D:\HardDisk-01.vhd"

   VirtualDisk: D:\HardDisk-01.vhd

IsBootable    AbsoluteStartingLba             Size       IsExtendedBootRecord  IsAligned

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

True                         2048           350 MB                      False       True

False                      718848            40 GB                      False       True

If anyone has seen this before or has any suggestions on how i can diagnose this further i'd really appreciate your feedback.

- Jason

Re: Error using Invoke-NaVirtualDiskSpaceReclaim on Server 2012 VHD & VHDX OS file

This is interesting.  It looks like the cmdlet is unable to find the mounted VHD copy, then fails when trying to clean up (because the VHD copy actually is mounted).

I would check the following things:  Is the VHD copy (filename [GUID].vhd) still present in the D:\ directory?  If so, is it mounted?  Check if there is anything suspicious about the mounted VHD (ex: it's offline, not assigned a drive letter/mount point, etc.)

Let me know what you find!

Thanks,

Steven

Re: Error using Invoke-NaVirtualDiskSpaceReclaim on Server 2012 VHD & VHDX OS file

Hi Steven,

I have fixed my problem thanks to your help! What had happen was the VHDX was located in a windows mount point to another drive which i found by using Get-NaHostDisk. After i found this, I then found the original VHD attached and online as well as a few other copies attached but offline on the host. I removed the attached VHD's and deleted the temporary VHD / VHDX files the cmdlet had created previously. I then re-run the Invoke-NaVirtualDiskSpaceReclaim cmdlet and pointed directly to the drive presented by netapp and all worked fine.

Thanks again for your help Steven, if you should ever find yourself Down Under in Sydney, there is beer or two waiting for you!

- Jason