TASK 7
???? Objective:
Attach the VHDX file c:\vhds\Disk1.vhdx to VM1 so it can dynamically expand when VM1 is running.
Step-by-Step Guide
✅ Step 1: Verify the VHDX File Type
Dynamic expansion means the virtual disk type should be dynamic (not fixed).
Let’s verify the disk type of Disk1.vhdx:
powershell
Copy
Get-VHD -Path "c:\vhds\Disk1.vhdx"
In the output, ensure that VhdType shows Dynamic.
If it’s not dynamic, convert it:
powershell
Copy
Convert-VHD -Path "c:\vhds\Disk1.vhdx" -DestinationPath "c:\vhds\Disk1_dynamic.vhdx" -VHDType Dynamic
✅ Step 2: Attach the VHDX to VM1
powershell
Copy
Add-VMHardDiskDrive -VMName "VM1" -Path "c:\vhds\Disk1.vhdx"
✅ Or do it via Hyper-V Manager:
Open Hyper-V Manager.
Select VM1 and go to Settings.
In the left pane, select SCSI Controller (recommended for hot-add).
Click Add Hard Drive.
Browse and select c:\vhds\Disk1.vhdx.
Click Apply and OK.
✅ Step 3: Verify Hot-Add Support (Optional)
If VM1 is running Windows Server 2012 or later and uses a SCSI Controller, the VHDX can be added without shutting down the VM.
✅ Step 4: Verify the Disk in the VM
Inside VM1, open Disk Management (diskmgmt.msc).
The newly attached disk should appear as unallocated.
Initialize it, create a volume, and format if needed.
Summary
VHDX file type: Must be dynamic for expanding.
Hot-adding supported if attached via SCSI Controller and OS supports it.
Now Disk1.vhdx is attached to VM1 and can expand dynamically.
Submit