What’s the most common hypervisor for home use? I’d say probably the “free” version of VMware vSphere. I’ve been using VMware for a couple of years now and it has served me well, but. There’s always a but, but what is it? For me it’s the overhead, I want to be able to run operating system level virtualization. To do this I had to ditch VMware, even though it works good for full virtualization, it just doesn’t cut it. The next question was what to replace it with? The answer was simple, SmartOS. I’ve always been a big fan of Solaris and ZFS. SmartOS is basically the best parts of Solaris, ZFS, KVM and Dtrace bundled and customised by Joyent. All these wonderful software in one package. I was sold, it was time to get this deployment going!
Do I need new hardware?
It depends. If you’re using a newer Intel Core i3/i5/i7 you’re probably fine. If you’re, like me, using an AMD CPU it’s time to invest. SmartOS won’t run on AMD CPU’s or older Intel CPU’s. I got a motherboard from ASUS (no server grade, just cheap and simple) and a Core i5. To this I added 8 GB RAM and two SATA disks which will be used to store the virtual machines. Why not use iSCSI you might say? If you do you’re missing out on all the wonderful self healing capabilities of ZFS, hence it’s best to use internal disks. OK, hardware’s sorted!
The easiest way to do this is to download an USB image and write it to a pen drive. SmartOS is made to be run from a USB pen drive or SD card. Have a look at the SmartOS wiki for instructions.
Converting virtual machines from VMware to SmartOS
If you’re running VMware ESXi 4.x this isn’t a big deal (in theory). There’s a way to convert and import the vmdk-files. Once again, the SmartOS wiki has the answer.
Now, was I using ESXi 4.x? Of course not, I was using 5.1. Converting a vmdk from 5.1? Nooooo. Won’t work. So, how do you get the machine(s) out of VMware and into SmartOS? I used a combination of dd, netcat and bzip2.
Start by booting up a Linux live cd on the VMware VM you want to convert. When it’s started you’ll need to start a receiving server using netcat on another machine, preferably one with enough harddrive space to fit the VM. Use the following command:
nc -l 19000|bzip2 -d|dd bs=16M of=vm_image.img
The server is ready to receive data, let’s send some!
dd bs=16M if=/dev/sda|bzip2 -c|nc [server ip] 19000
This will send the contents from sda on the Linux VM to an image file on the server. I’m sending it through bzip2 to avoid sending unnecessary data, it’s better to just compress all them zero blocks! OK, the data is extracted from VMware and now resides in an image file. The next step is to transfer the data into SmartOS. Have a look here at Ed Plese’s blog, he explains how to set up a new VM using KVM. It boots an iso file, which is perfect. Boot the same live cd as on VMware earlier and we’ll transfer the image to the virtual disk in SmartOS. Just make sure the virtual disk in SmartOS is big enough to fit the data on the image. When booted, issue the following on the VM:
nc -l 19000|bzip2 -d|dd bs=16M of=/dev/vda
Now, make sure you type /dev/vda instead of /dev/sda since the disk is called vda in SmartOS instead of sda. Now, send the data from the server like this:
dd bs=16M if=vm_image.img|bzip2 -c|nc [vm ip] 19000
When the transfer is done, just reboot the VM and the machine should boot up. This will only work if you’re using UUID’s in /etc/fstab on the virtual machine, if not you’ll have to change from sda to vda before doing the initial transfer out of VMware.
I’ve had the system up for about three hours, works like it should. No complaints yet, but if you’re a point-and-click kind of guy, this probably isn’t for you. SmartOS is text console all the way. Just the way I like it. Plus the fact that the CPU/memory restrictions in the free license of VMware won’t be an issue. No restrictions here! At last, thank you Joyent! This is one sweet piece of software!
VM’s running in SmartOS