Expanding disk partitions when deploying using ADS and VSMT

 

At last nights Virtual Server 2005 Technet evening in Edinburgh, I was asked whether it was possible when migrating a system using VSMT if the hard disk could be expanded when deploying the image. Since arriving back home, I've now had a chance to try this out and can confirm the answer is yes. As an aside, I also discovered why the deploy step too quite so long, it was because I hadn't updated the virtual machine additions on the ADS controller - the whole deploy step takes no more than 3 minutes when I updated it. Oops. For the disk size change, here's what you do....

Two files which vmscript generated need updating. First, you need to update the <servername>_createvm.cmd script to ensure that a larger hard disk is created when the blank virtual machine is created on the Virtual Server host. I wanted to add another 100MB to my disk. Look for the lines similar to below with the "-VirtualDiskSize" parameter. Originally, it was 544 (both in the comment and in the actual executing line), and I've updated them to 644.

echo Create disk:0 with size:644MB
%VSMT_SRV_APP% -remoteVs:%VS_NAME% -CreateVirtualDisk -VirtualDiskPath:%VM_DISK_PATH%\JJHNT4SVR_disk_1.vhd -VirtualDiskSize:644 %VSMT_DEBUG_FLAGS% -nologo
 

You also need to change the <server>_internalstate.xml file in a couple of locations which I've highlighted below. Again, adding 100MB changed in this case from 544 to 644 for the first instance, and 512 to 612 for the second instance.

<diskDrives>
<targetUsed>true</targetUsed>
<sourceDriveIndex>0</sourceDriveIndex>
<sourceDeviceID>\\.\PHYSICALDRIVE0</sourceDeviceID>
<sourceDevicePath>\device\harddisk0</sourceDevicePath>
<sourceBusType>ide</sourceBusType>
<sourceBusNum>1</sourceBusNum>
<sourceDeviceNum>1</sourceDeviceNum>
<sourceSize>512</sourceSize>
<targetSize>644</targetSize>
<targetBusType>ide</targetBusType>
<targetBusNum>1</targetBusNum>
<targetDeviceNum>1</targetDeviceNum>
<targetDevicePath>\device\harddisk0</targetDevicePath>
<targetVHDName>JJHNT4SVR_disk_1.vhd</targetVHDName>
<hostsBootPartition>true</hostsBootPartition>
<targetDeviceIndex>0</targetDeviceIndex>
<targetPartitions>
<capturePartition>true</capturePartition>
<targetPartitionIndex>0</targetPartitionIndex>
<logicalDrive>C:</logicalDrive>
<size>612</size>
<bootable>true</bootable>
<bootini>[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00 [VGA mode]" /basevideo /sos
</bootini>
<description>Image from device:JJHNT4SVR source hard drive[0] ide[1:0] partition:1 for logical drive:C:</description>
<sourcePartitionIndex>0</sourcePartitionIndex>
<adsImageName>img_JJHNT4SVR_1_1</adsImageName>
<hostsWindowsPartition>true</hostsWindowsPartition>
<sourcePartitionType>7</sourcePartitionType>
<isExpandedLogicalDrivePartition>false</isExpandedLogicalDrivePartition>
<isExtended>false</isExtended>
<fileSystem>NTFS</fileSystem>
</targetPartitions>
</diskDrives>

If all goes well, once you boot up and run disk administrator (if this is NT4), you will see a bigger disk for which the OS partition can be expanded into using whatever your normal choice of tool would be.

What I haven't had a chance to try is whether if you change these files before the image capture, the partition will be expanded for you once you boot up the new server. That'll have to be for another day to find out though.