Building a VMware Appliance Playpen
I decided to use Ubuntu 6.06 as a playpen for building OOo. However one of the things about a playpen is that you want to make sure that any changes that you make do not contaminate your main working system. Until recently this really meant having a dedicated test box, but thanks to the introduction of free virtualisation products from VMware and Microsoft , the need to have a separate test box is now history — as long as you have enough memory and disk on your host system.
There are some differences between the VMware and Microsoft products, the main two being that (i) VMware only offers a limited version of its desktop virtualisation product for free whilst Microsoft offers its fully featured Microsoft Virtual PC (MVPC) product, and (ii) as MVPC is primarily targeted at hosting Windows OSs, its Linux support is a little lumpy (especially around virtualised graphics and display driver interoperability). I first evaluated Ubuntu after downloading (using bitTorrent) a pre-packaged appliance from a link on the VMTN Appliances page. The only problem was that appliance this had a disk size of 8Gbytes, which is really too small to do a full OOo build. So then I decided to do an install of Ubuntu into a bare MVPC VHD, but I got bogged down in problems getting Ubuntu to work with the MVPC graphics adapter. After some head scratching and lots of Internet searching I then decided to go back to my Ubuntu appliance and resize its disk to 12Gbytes.
Resizing the disk is a two step operation. First, in order to resize your virtual disk container, you need to use the vmware-vdiskmanager.exe utility. Use the -help option to give you the command to type. [Unfortunately you won't find this in the VMware Player distribution. However it is part of the tools supplied with either the VMware Workstation or the free VMware Server product. One easy way of obtaining it is to temporarily download and install the Server, use the tool, then you can remove the Server product. Note that if you do this you may first need to temporarily remove Player.] This resize takes only moments, and once done the VHD will have a "physical" size of 12Gbytes even though the allocated partitions are unchanged.
The second step is the now to resize the partitions to extend the primary partition to take of the extra 4Gbytes. To do this you need to download a nice utility called GParted from SourceForge. Unfortunately though GParted is already pre-installed on the Ubuntu image, unlike Partition Magic, it cannot resize mounted partitions. Hence you will have to go through the following palaver — but what the heck GParted's free, and this all takes about 15 mins. The download is a 30Mbyte ISO image of a CD bootable Linux image containing the partition resizing utility. Player supports direct mapping of ISO images onto the virtual CD-ROM, so you don’t need to blow this onto DVD or CD. However, you will need to tweak your VMX file (The full VMware Desktop documentation explains this, but they assume that the typical user of Player won’t need to do this sort of stuff. ).
ide0:0.deviceType = "cdrom-image" ide0:0.fileName = "<what ever your image path is>" ide0:0.present = "TRUE" ide0:0.startConnected = "TRUE"
You can hit ESC during the Bootup POST phase to select CD-ROM boot, but I found it a real pain trying to set focus to the VMware session and hit ESC quick enough, so in the end I did a reboot and hit F12 to get into the BIOS then temporarily promoted the virtual CD to the first boot device ahead of the VHD. Now after reboot, the grub loader will take you into the minimal GParted Environment. The boot sequence is quite long and you might think that it has hung, so you need patience. My laptop did this for almost a minute whilst the OS booted. I also had some problems with the display driver on my laptop, but could work around this because the GParted boot process allows you to select the Manual display driver and pick a minimum SGA compatible device (you aren’t going to be needing high performance graphics during this resize are you?) Once you get into the GParted full GUI which looks similar to Partition Magic’s. You can now resize your VHD partitions by scheduling the following steps: This can be scheduled as a sequence and when you action it GParted then takes about 5-10 mins to do the move.
Resize the extended partition to include the end 4Gbyte
Relocate the swap logical to the end of the extended partition
Reduce the extended partition, moving its start up to the start of the swap logical partition
Resize the system primary partition to take up the 4Gbyte gap now created.
Once done, you can reset the boot sequence and boot from the VHD. You might also want to reset the VMX file or set the ide0:0.present and ide0:0.startConnected parameters to false. Once you’ve done this you can boot the Ubuntu Appliance and log on. (The user and password were Ubuntu). A quick df will now show that you now have a 12Gbyte files system and are in business. The only other thing that I had to do was to resize the screen to a default 1024x768, because that the default size of my Laptop display.
One issue working with VM appliances is that you will find that transferring files to and from your host machine is a bit of a pain with VMware Player, so a couple of tricks can be used here. The first is to use a FAT formatted USB stick. (You will find that you can enable and disable this in the Player Device menu (remembering to sync your file systems first) thus passing it between the host and the appliance). The second is to run an FTP server on one of the machines.
Also see my article Error Handling in VBScript - Part II for more details.
- Comments (1)
- Post a comment