Monday, March 30, 2015

How to convert from dynamic to fixed disk

"Power down VM"
Stop-VM –Name "dubvmv01"

"Convert from Dynamic to Fixed disk"
Convert-VHD c:\clusterstorage\volume11\dubvmv01\dubvmv01.vhdx -destionationPath c:\clusterstorage\volume11\dubvmv01\dubvmv01-f.vhdx -VHDType fixed -Confirm y

"remove the old VHD file from the VM"
Remove-VMHardDiskDrive -VMName dubvmv01 -ControllerType 1 -ControllerNumber 0 -ControllerLocation 0

"add the VHD back to the Virtual Machine"
Add-VMHardDiskDrive -VMName dubvmv01 -Path c:\clusterstorage\volume11\dubvmv01\dubvmv01-f.vhdx -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 1

"delete the old VHD File"
Remove-item c:\clusterstorage\volume11\dubvmv01\dubvmv01.vhdx

"Start the VM"
Start-VM –Name "dubvmv01"

Original script edited from Ideas from Aidan Finn's post on:

Convert Hyper-V Virtual Machine From VHD To VHDX