openzfsonwindows/openzfs

Can't use VHD[X] files on ZFS

florean opened this issue · 7 comments

System information

Type Version/Name
Distribution Name Microsoft Windows
Distribution Version 23H2
Kernel Version 22631.3593
Architecture AMD64
OpenZFS Version zfswin-2.2.3rc4

Describe the problem you're observing

Power Shell commands can't access VHD files on ZFS volumes. I appear to be able to create them successfully, but accessing them afterwards with a command like Get-VHD results in an immediate failure.

Describe how to reproduce the problem

In a Power Shell window in a directory on a ZFS volume:

  1. New-VHD -Path .\test.vhd -SizeBytes 16GB
  2. Get-VHD -Path .\test.vhd

Passing the full file path makes no difference. Creating a VHDX file has the same problem. Sorry, I don't use Windows much so I don't know how to get much more than that, but I'm happy to follow any instructions to provide more detailed info.

Include any warning/errors/backtraces from the system logs

Get-VHD : '.\test.vhd' is not an existing virtual hard disk file.
At line:1 char:1
+ Get-VHD -Path .\test.vhd
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VHD], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.Vhd.PowerShell.Cmdlets.GetVHD
PS C:\WINDOWS\system32> New-VHD -Path .\test.vhd -SizeBytes 16GB
New-VHD : The term 'New-VHD' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ New-VHD -Path .\test.vhd -SizeBytes 16GB

addon needed?

Ah
Hyper-V | Hyper-V Management tools | Hyper-V Module for Windows PowerShell

Screenshot 2024-05-23 at 12 41 09

OK, gimme a few to implement

@andrewc12 note to self for regression tests

Wow, amazing response. I wanted to note that I was able to use a VHDX file by setting it up on a NTFS drive and then migrating the VM to a ZFS drive, but it looks like you've already solved it.

Is that File Spy you're using for the events or something else? I've had problems running Steam games from ZFS and I'd like to be able to do some troubleshooting around that.

Thanks again for your quick response!

Yeah, filespy.exe is good at seeing what requests and responses it sends, usually to a drive (say, if ZFS is E:). You can do the same against a drive that is NTFS and look for anything different in the responses. I think its home is here http://www.zezula.net/en/tools/main.html

filetest.exe is a similar tool where you can set parameters and send a request to see reply. More useful once you know what is wrong from filespy.exe.