I'm using VMWare Fusion to run Linux on OS X, which I need as a build and test environment for various things. One of the important things to do when using it with a modern Linux (which runs udev), is to go to the Network Settings of the VM and have it generate a fixed MAC address (otherwise the MAC will change on every boot, which causes udev to assume new network interfaces). Other than that Ubuntu 8.04 LTS was just as easy to get going as Debian Lenny.
Having built my Ubuntu 8.04 LTS VM, I then wanted to duplicate it so that I had one to use for building things, and one as a point to migrate my old Ubuntu 8.04 LTS laptop configuration so I could run various things that I haven't yet migrated -- without lugging my old laptop around or ssh'ing into it remotely. After a bit of searching, it turns out that with VMWare Fusion cloning a VM is as simple as many other things on the Mac:
Make sure the VM (and ideally VMWare Fusion) isn't running
Copy the whole VM directory to some other name (in Terminal, or Finder or however suits)
Start VMWare Fusion up again, and Open the new VM
Answer "I copied it" to the question that comes up wondering about this VM that it found in a location it didn't know about (allows it to adjust things that should be unique per VM to be unique again)
Go to "Settings" on the VM and click on the VM name to give it a different name
Job done. (Moving a VM can be accomplished in a similar manner, but answering "I moved it" to the question in the final step -- and deleting the old "broken" VM from the menu.)
The only thing missed in this is the filenames of the disk images.
They're local to the directory the VM is in, so don't really matter, but
if one is particularly fussy the .vmx
can be edited by hand
and the .vmdk
renamed to suit.
While doing this I also discovered some useful tips on using debootstrap with Ubuntu (help page). In particular:
locale-gen en_NZ.UTF-8
is needed to silence the locale warnings (the normal
dpkg-reconfigure locales
didn't seem to want to run in the
chroot for some reason).
The other thing I discovered in doing this is that Apple Disk Utility can be used to create an ISO image from an existing disk (also from the command line; and convert DMG to ISO):
Start
/Applications/Utilities/Disk Utility.app
Select mounted CD/DVD
Click on "New Image+" in the top button bar
Select "CD/DVD Master" for the format, and "None" for encryption
Let it extract disk to a
.cdr
After extraction rename the
.cdr
to.iso
(Disk Utility is determined that the extension must be.cdr
presumably so it can recognise it to write it out to a new CD/DVD, hence the need to rename it afterwards).
From the command line this is:
diskutil unmountDisk /dev/disk1
dd if=/dev/disk1 of=file.iso bs=4096
hdid file.iso # Loopback mount