Windows create pool in vhdx with ps

From OpenZFS on OS X
Jump to: navigation, search

Create[edit]

$imgpath = "c:\tmp\test.vhdx"

$imgsize = 527433728


New-VHD -Path $imgpath -SizeBytes $imgsize

$disk = Mount-VHD -Path $imgpath -PassThru


get "Physical" disk for mounted vhd

$physdisk = Get-CimInstance -ClassName Win32_DiskDrive -Property * | Where-Object {$_.Index -eq $disk.DiskNumber}

$physdiskpath = $physdisk.Name|split-path -leaf

zpool.exe create -O casesensitivity=insensitive -O atime=off -o ashift=12 wintank $physdiskpath

Destroy[edit]

zpool.exe export wintank

Dismount-VHD -Path $imgpath