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!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment