Experiences with set and forget VHD enlargement
Posted by admin on February 17th, 2007Aarrrgggh! I’m trying to write a “set and forget” script that increases the size of a VHD under Virtual Server. I’m so close.
I run, cscript BumpVHD.vbs myvirtualmachine 10000 and it takes care of all the little details:
- Save State on the Virtual Machine, “myvirtualmachine”
- Find the [first] VHD within the VM
- VhdExpand the VHD to the new larger size adding 10000 Megabytes
- Mount the new VHD with VHDmount
- Diskpart, select disk n, select volume 1, extend
- Unmount the new VHD
- Delete the original VHD
- Rename the larger VHD to the same name as the original
- Restore the VM from Saved State
Now I need to confess, it doesn’t completely work. The additional drive space isn’t recognised until the VM is rebooted. Strange part is, new files seem to write ok inside the VHD. I need to test this a little more
Looks like I need to should reboot the VM instead of suspend, didn’t really want to do that. I should probably enumerate all the VHD disks as well, but I wont. Then there is the need to disable autoplay and maybe automatically assigning drive letter. Bahhh, now we’re talking details. :)
Anyway I don’t have anything polished to download just yet, but I’d thought I share my experiences so far. Keep you posted.
Recent Comments