Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts

Saturday, July 4, 2009

Compacting VirtualBox image - Ubuntu edition

It is well documented among the VirtualBox community that 'dd' is not enough to zero out a disk image for compacting. The preferred tool to do so is 'zerofree'. Now, the issue is that it requires the disk to be mounted as readonly. This is fine and dandy, except when you only have one partition to work with. My workaround is to use the Ubuntu minimal CD. The steps necessary are:

* Before booting the minimal CD, make sure you've got zerofree installed
'sudo aptitude install zerofree'
* Boot the minimal image.
* Enter recovery mode.
* In the language selection screen, select "Go Back" instead of picking a language.
* Start a new shell.
* Make a mountpoint, e.g.
'mkdir /mnt/r'
* Mount the disk image,
'mount -n -o ro -t ext2 /dev/sda1 /mnt/r'
* Copy zerofree and the necessary libraries to the tmpfs:
'cp /mnt/r/usr/sbin/zerofree /bin/; cp /mnt/r/lib/libext2fs.so.2 /lib/; cp /mnt/r/lib/libcom_err.so.2 /lib/'
* Run zerofree
'zerofree /dev/sda1'
* Profit!

Thursday, July 2, 2009

Installing Ubuntu in VirtualBox

These steps are for OSX Leopard as a host, Ubuntu Jaunty (9.04) netinstall.

* Don't use the default network adapter. Use the Intel one instead.
* I set the partition manually to just have one big partition, ext2. No swap partition was set up because a) I have enough memory allocated, b) I can always set up a swapfile, c) having a swap partition increases the disk image file size,
* gksu, make, and linux-headers-generic are required to install guest additions.
* The video driver was giving me problems. Installing the guest additions with xserver-xorg-video-vesa alone did not work for me. I've narrowed it down to either xserver-xorg-video-vmware, xserver-xorg-video-fbdev, linux-headers-virtual, or a combination thereof. Afterwards I've removed all but xserver-xorg-video-fbdev and things are still working.
* localepurge and debfoster are your friends when minimizing the disk image size.