Monday, March 25, 2013

Convert a Physical Mac into a VM Guest under VMware Fusion 5




In the PC World, there many cool migration tools to convert a live, physical and running Windows machine into a VM (Virtual Machine) guests. I have migrated quite a few using VMware's own migration tool and they work great. Converting Linux and OSX isn't so easy.

OSX makes it much more difficult but it is not impossible. I plan to convert some Apple Xserves into VMs and consolidate them into a few running ESXi 5. That will be a later post as I am getting my feet wet; figuring this out and sharing it to those interested.

This tutorial will use VMware Fusion 5. You will need Fusion 5. It doesn't cost much and apparently the licensing allows you to install on 3 macs which is way cool.

I have switched completely over to VMware Fusion 5 from Parallells and VirtualBox on the Mac platform. It makes it  easier to convert a VMware machine build into something I can import into ESXi. The difference between Parallels, I won't go into here but so far, I am digging Fusion. I really like the fast suspend.

To Clone a Physical Mac there are a few things you need to consider. 

1)Is it legal?

Well, Servers from 10.5 can be virtualized. Workstation/Desktop (non-server) OSX 10.7 and 10.8 can be virtualized. For my use case, yes, I am completely legal.   I am converting a 10.6.2 Snow Leopard server. I'll even try as far back as 10.5 if any of those still exists in my inventory. There are back-door step (changing a plist file) to virtualize 10.5 and 10.6 non-server but I won't go there.

2) You need to build a base OS build from scratch to act as your Cloning "middleman." This should be a minimal Mac OS X VM guest build just big enough to run something like Carbon Cloner

3) You should have a spare USB drive or network share to store your "cloned disk images."


How To Convert  a Physical Macintosh into a VMware VM Virtual Machine.

It is a multi-step process so I will outline how I successfully converted a few Macs.

Step 1. Clone your Physical machine using your cloning tool of choice. CarbonCloner is the most popular. Clone it to a Sparse Disk Image. It makes it easier to transport and store multiple clones. Do not try to clone to a drive and use it as your source. It will probably be a waste of disk storage and you wont be able to boot from it in your VM. Stick to creating DMG images you can clone to.  I won't go into details how you do this but there are probably hundreds of tutorials on cloning your mac on the internet. If you are a mac IT pro reading this post, it is most likely you've already done this.

Step 2. Build your "middleman" OSX build. Here, you have to actually install a full running OSX that runs inside Fusion 5. Trust me, it is pretty easy unlike various hack attempts in the past. No pseudo hackintosh in a VM or special CD-ROM iso boot disk. It is a straight install as if you are installing on to a real Mac.

I chose something simple. I did a quick install of 10.7. You can even install from a DMG. I believe I used the ESDInstall extracted from the app store download. The whole process took 20 minutes on my setup and the size was around 12 GB for a virgin system. I simply stored my build on an external drive that I can shuttle around.





OK. We've gotten this far. At this point. I would strongly suggest backing up your middleman OSX so you can re-use again if you want to clone more physical Macs. You will end up discarding the middleman's drive when you are finished.

Step 3. Add additional Virtual Hard Disk(s) to your "middleman" OSX build. In my example, I added two more just for the sake of experimentation.





Step 4. Boot into your middleman OSX, format your additional virtual drives and prep them for destination clone. Remember to format them GUID.




Step 5. You should have your sparse disk image from Step 1 from somewhere accessible by the middleman OSX. You can copy from the network or from a share if your guest's OS drive is big enough.

I much prefer using a USB drive with all my builds. Simple. Just plug in an external USB drive and allow Fusion to take ownership. USB 3 is supported on Macs that have USB 3. The VM will see the USB mounted mac drive as a mounted external drive just as your normal hosts sees it.




Step 6. The Clone process. If you've gotten this far, you are 90% done. Run Carbon Cloner or whatever cloning tool you have to clone your sparse image to your second or third newly added virtual drive. Let the clone process run the usual course as you would clone a real mac.
As you can see in the screenshot,I am cloning from my sparse disk image.







Step 7. When finished, shut down.
If you think you can reboot into the next step, you will be in for a big surprise. This is the error message I got from trying to boot a 10.6.2 server from a 10.7 middleman install. Unfortunately, there are probably boot flags and indentifiers that restrict what can run/boot on what OS.


You might be safe and and skip to Step 9 of you are cloning from the same build as your middelman OSX. For example, cloning from a real physical 10.7 Mac if you were using my example.


Step 8. Now, this is the most important step I had to figure out. Change your Virtual Machine's device setting. It is not easy to find and not so obvious. Click on the "General" under the System settings.


And this the part that is not so obvious. The Name and OS look like normal labels.




But they are actually clickable input fields. This is my pet peeve. It shows a lack of UI (User Interface) understanding in the most fundamental way in regards to how applications should be designed.  The gist of this section is, you have to change the OS device label to the updates guest should be running. My original build was 10.7 and now, I had to now change it to 10.6 so I can boot into a 10.6 build.
To boot back to my middleman OSX, I would have to go back and change the OS device label back to 10.7




And that is pretty much it.

Step 9.  Select your new Virtual Hard disk as the new boot drive under "Startup Disk" from the main Settings. Reboot and test your new guest VM.



And Voila! An older 10.6 Xserve build running inside Fusion on my Macbook.


At this point, you should just delete the original drive containing the bootable "middleman" OSX. You can remove it from your inventory from the settings. Now, you should have a full running clone of your existing physical mac. You may want to install VMware guest tools but for me, I will wait till I have my builds migrated over to ESXi.






So far I have a few Macs virtualized and I will undergo some testing before I embark on building out an ESXi 5 build on a physical 12 core XServe which will host these new Mac guests.

There you have. Hopefully this will help some people looking to virtualize their macs.

Extra Credit for Mac IT guys:

And a little extra tidbit of info. If you are looking to doing this as a failover precaution due to the fact Xserves are no longer being sold, you can do scheduled nightly clones from a live running real mac. In essence,have a VM guest that is continually synchronizing with a live mac in the event the live mac fails and the VM guest can take over.

This is my style of ghetto IT that works:

You would need to set up two Carbon Copy schedulers. One on your live Mac and one on your middleman VM mac.

Either your live mac or VM Mac would need to share out a volume or have both access a shared network storage. The Live Mac would backup nightly to a sparse image on the shared network volume. Then schedule the middleman mac to clone from that nightly backup to your new VM second drive. You would need to schedule them apart to let the live mac to finish it's clone. Usually it should be quick because Carbon Cloner doesn't do a full clone on subsequent clones. It only copies the incremental. You can also use SuperDuper, Chronosync or old fashion rsync. With rsync, you just need to add the -E flag to copy extended attributes. I would personally run a cron job with rsync every hour to get at least an hour of synchronized data.

So in the event your Xserve (or other Mac server) physically dies, you should have a fairly up-to-date VM guest ready to be fired up and run while you go ebaying for a replacement Xserve or buy a new Mac Pro.








Sunday, March 24, 2013

ESXi 5 Server on a Thinkpad T420

Well, it looks like I may be getting a new laptop so I'll need to retire my trusty less than one year old Sandy Bridge Thinkpad T420. And that retirement plan is re-purposing it to run as a mobile VMware ESXi 5 Virtualization server. Yep, running ESXi on a Thinkpad. How insane is that!


In fact, it may be one of the best laptops for running ESXi. Why? This particular T420 has
eSATAp, removable drive bay, and cheap 16GB RAM upgrade. RAM is the most important thing with a VM server and this has plenty to run half or so dozen LAMP stacks.

eSATAp uses USB and eSATA in a single connection. This means you can power external 2.5" SATA drives. Or, you can also use an eSATA dock but that defeats the portability factor.


Want more permanent storage? Well, you have three internal drives if you choose to replace the DVD drive with a HDD DriveBay module. You get the internal 2.5 HDD, the mSATA slot, and drivebay.


See, this is exactly what I mean:


What can I say. This Thinkpad will live on and continue to make an important contribution in this one geek's life. I already have a Fuji MX130 running as my home lab ESXi server but I can use the Thinkpad to shuttle VMFS data stores, and do live presentations.







Friday, March 22, 2013

Insane Speeds

If you've been reading my blog, you'll know I am a big fan of fast storage.


Here is something to feast your eyes on.





I'm getting close to 700 MB/sec at peak. Seven Hundred Megabytes per second.

This is an undisclosed SAS RAID I am working with. Insane. This kind of speed cost $$$$$.
You can edit some nice 4K HD videos with this speed.

Thursday, March 21, 2013

Data hoarding and collecting hard drives.

Ever since the floods of Thailand, I've been hoarding drives as they go on sale. Just for me, I probably have over 60TB of drives in various sizes. These 4TB Backup Plus drives were dirt cheap the other day on Amazon for $140. 7200 rpm, SATA III 6Gbp/s and Thunderbolt upgrade-able.
These external drives usually cost much,much less than their internal counterparts. There are plenty of youtube videos on how to crack open these enclosures for you to use as internal drives.

I may just want to upgrade my Drobo 5D and replace all the 3TB drives.


Wednesday, March 20, 2013

Cheap USB 3.0 Gigabit adapter for the new Macbook Pros

Need a USB 3.0 Gigabit adapter for your new Macbook Pro, Macbook Retina or new Macbook Air?
Especially, if you don't want to sacrifice that precious Thunderbolt port or rely on Apple's 10/100 ethernet USB dongle? Well, any pretty much any ASIX AX88179 Chipset USB 3.0 to Gigabit adapter will work. There are scores of them on Amazon, Ebay and NewEgg.

They come in different colors, different packaging from different manufactures. However, they all have pretty much the same guts. A while back, I reported having a DOA, bad experience with an Anker USB 3.0 Gigabit adapter. Today, I am reporting better luck with a NewEgg Rosewill adapter using the same ASIX AX88179 chipset.

I recently picked up a few for $17 on sale (regularly $28) at Newegg.




The RNG-406U is a standard, sturdy dongle. In fact, it looks more attractive than the Anker that failed me prior.

After opening the box, I quickly loaded up the latest driver from ASIX's website and got my Gigabit speeds. I tested under Mountain Lion 10.8.2 and it works as advertised. I also have the white Apple USB 2 10/100 ethernet dongle and that thing is pretty slow. Under testing, the Rosewill Gigabit adapter  was hitting 117 MB/sec using iperf so I am definitely hitting Gigabit's maximum theoretical limit (of 125 MB/sec). In fact, it was just as fast as the internal gigabit on my Macbook.



I even plugged it into my Thinkpad T420 running Ubuntu via a USB 3.0 expresscard and was able to make install the drivers easily. I can confirm it works pretty good under Unbutu 12.04 after installing the kernel drivers. So far, so good. A USB gigabit dongle that works on multiple platforms. I ended up buying three more to leave at different locations. I'm always developing server apps and usually need a few network ports for testing.

One big major issue. Of course, I wouldn't do you guys a service if I didn't acknowledge one glaring issue.

The main issue with this dongle (that I will show how to easily resolve) is the fact, you need to have it plugged in at boot.

If you unplug and replug later, it will not work again. If your machine is already booted or just recovered from sleep, the dongle will not work. The operating system will recognize the dongle but no connection. I usually never shut down or reboot my mac. If I am transporting from home and work, my machine usually just goes to deep sleep. Hence. this was an issue I wanted to resolve.

Now, under most circumstances a simple command line:  sudo ifconfig enX down and ifconfig enX up cures all the problems. However, simply restarting the network interface does not work.

To solve this problem, simply unload and reload the kernel kext file (OSX driver). It is located in the plugin folder of the IONetworkingFamily inside System/Library Extensions.

To unload, type in the terminal :

 sudo kextunload /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AX88179_178A.kext  

Then to reload, type in the terminal:

 sudo kextload /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AX88179_178A.kext  

This will fix it. Simple isn't it? I just make a .bash script and leave it in my home directory and drag-n-drop it into the terminal to run. Voila, working dongle again.



There you have it. A cheap USB 3.0 Gigabit solution. I've even seen a few ASIX AX88179 dongles that are built in 4-5 port hubs. I may try that next.


Monday, March 18, 2013

Practical UNIX style backups using an ArchLinux PogoPlug

If there was ever a reason to get a $15 pogoplug hacked to run Arch Linux, this article may sway you.




I'm going to show you how I turn an ordinary $15 linux gadget into a useful "rsync" backup client.

The tasks which I will share with my readers is the typical things I would do administering *NIX based servers. We set up redundancy and failover using some simple and tried and true methods. There really is no rocket science involved. After doing it a few times, it becomes second nature. And because of the simplicity, it becomes apparent why I love small gadgets running Linux.

The articles and methods are pretty much simplified but they illustrate the simple and powerful nature of the powerful command line.

Today, I decided to turn one of my Pogos into a remote robo-copying slave. Its only job is to do remote backups of my GIT server. Then I realize, it should be running independently as a working droid (thinking Star Wars) to find,scan my network and backup any *NIX computers running in my household. I have a few spare older 250-320GB drives that needed to put to good use, so I pared them to a Pogo.

Normally, you would initiate the copy and backup from your desktop/laptop to the PogoPlug running some form of Linux/NAS. Here, I do the reverse. I have my pogoplug go out and do all the work.

So if I turn on my NetBSD G4 mac from 5 years ago, or come home with my Thinkpad, or turn on my iMac, it would automatically back them up without my intervention. I wouldn't have to think about it. If I was working on some code on my Thinkpad. I could go out to the back-yard to my patio and from my Macbook, I can pull source code that was already synced 5 minutes earlier off the Thinkpad.

Think of it as a reverse time machine. The concept is not new. We have dedicated backup servers that do nothing else but do remote backups off-site. Here, I am using a low powered PogoPlug running ArchLinux.

In fact, it took me 30 minutes to implement it. This is the power of *NIX. So I will share it with my readers today. Everything is meant to be done on the Pogo itself.

First, I logged into my Pogo and copy my SSH keys from my Pogo to all my target computers. So if I change my passwords, it would still authenticate against it. As I write this, I am thinking R2-D2 talking to the main-frame of the Death Star. If you don't know what SSH keys are, take a detour and google it before proceeding further. In short, keys allow machines to talk to one another without using passwords.

In arch, it is pretty easy.

ssh-copy-id username@remote_server

It will simply copy your keys over to the remote machine.




Next, I wrote a small bash script that pings the remote machine. If the machine pings, it means it is online and it will then attempt to rsync with it. Rsync is the tried and true industry standard for remote file synchronization/file copies.

Feel free to use this bash script. Simply, change the variable of the "remote_machine" to the IP or hostname of the computer you want it to ping and rsync. Since my network employs Avahi/Bonjour, it pretty much works by hostname. EG. My Thinkpad is accessible via ThinkpadT420.local
In this example, my remoteserver.local is my intended target.

I do a simple IF THEN conditional check in my bash script. If the machine doesn't ping, alert us with a message. Otherwise, proceed to rsync.


 #!/bin/bash  
 remote_machine="remoteserver.local"  
 PINGCOUNT=2  
 PING=$(ping -c $PINGCOUNT $remote_machine | grep received | cut -d ',' -f2 | cut -d ' ' -f2)  
 if [ $PING -eq 0 ]; then  
           echo "Something wrong! server: $remote_machine down"  
 else  
           echo "All good: $remote_machine"  
           echo "We will rsync now"  
           rsync -au --progress --stats root@remoteserver.local:/var/www/ /media/passport/rsync/vps/www/  
 fi  


My rsync command is pretty straightforward here. Archive and update. I added progress and stats for my own reference.


rsync -au --progress --stats root@remoteserver.local:/var/www/ /media/passport/rsync/vps/www/ 


Basically, my rsync logs into the remote server, copying the /var/ww/ into my destination of my 1TB Western Digital USB drive labelled, passport. The copies go into a folder, /media/passport/rsync/vps/www


After writing it, I tested it. I named my script vps_backup.sh

I then change the permissions to executable and did a dry run.



As you can see, the files and folders populate from my remote machine. The below screenshot shows two web directories. One from my iMac and another from a remote VPS.





Lastly, I would use a cron job to run every few minutes. You can even do cron job schedules in Webmin. I would recommend installing webmin so you can have a web based administratie interface of your Pogo. It simplify things quite a bit.

When you log into webmin, head over to System . Scheduled Cron Jobs.


Cron Jobs under webmin is pretty much a point and click.

I specified the user running as "root" to have full system rights and pointed to the script I wrote earlier in /root/vps_backup.sh. For this example, I specified a daily midnight schedule but I could change to hourly or every 5-10 minutes.




And there you have it. A simple (well, at least for me) way to do interval backups from a Pogo.



Saturday, March 16, 2013

Lenovo K5923 Multi-gesture Wireless Touchpad review


Lenovo K5923 Multi-gesture Wireless Touchpad.


I'll preface and tell you right now, I like my Apple Magic Touchpad. In fact, I love the glass trackpads on the Macbooks. They're the only input devices that I choose over the original IBM track point or even the Microsoft ergonomic trackball. I could use nothing but those glass trackpad.

So when I saw a Lenovo multi-gestured touchpad, I decided I had to have one for my Thinkpad. Boy was I completely wrong. So here is my scathing review to save you the time and money from buying this thing.

They normally retail for $69 but can be had for $49 or even as low as $29. Trust me, I would never buy this POS for $70.


Looks.

First of all, it is matte satin black which is cool with me. It matches the Darth Vader, murdered out black Thinkpad. However, the build quality is crap. It feels flimsy.  Even though my Thinkpad is made by the same company, this trackpad is nowhere up to "Thinkpad" build quality you expect from Lenovo.



It is definitely no where as nice as the Apple Magic aluminum finished glass trackpad. It is like comparing a Jaguar to a Kia. Side by side, you can tell which is a premium device and what is cheap.
Now, I know where and how auto journalists complain about fit-n-finish regarding plastic materials when they review cars. This has the same cheap kind of plastic you find in a Hertz rental car's dashboard.

Fit and finish is pretty important considering you will be actually touching this thing on a day-to-day basis.

Dongle. I hate dongles. Why can't manufactures stick with bluetooth. Logitech uses dongles too but at least you can tuck and hide the dongle inside their mouses/trackpads/keyboards when not in use. I'm pretty certain I will lose that dongle someday.

Operations.

Boy was I confused. Nothing was working for me. I kept on muting my volume by accident.
I googled and googled for drivers or some sort of way to set gestures. Nothing was working for me.
So I decided to read the manual. This is the first device in years that I ever had to open up the user's manual. New DSLR camera? RAID? Switch. Nope. I never read the manual for any of those devices. This one, I had to pull out the manual to figure out it had no drivers or control settings under Window's control panel. The front box advertised it was Windows 8 out of the box and you would figure there would be some sort of control-panel setting to illustrate the type of gestures it supports.
In this regards, windows is pretty lame not to have it in the control panel. Hit the search bar and type in "gestures, mult-gesture,trackpad" and none of the help files come up. I can easily see how normal consumers would get flustered with this.

One other problem. My OS of choice is Ubuntu/Mint on my Thinkpad and OSX on my Macs. This touchpad works as a dumb mouse in Mac OSX. So forget about using it with a Macintosh running 10.8 Mountain Lion.
Only Ubuntu supports 2 finger zoom gestures and scrolling. I downloaded some 3rd party, open source stuff like Ginn,utouch, synclient, and Touch-Egg. Still no real progress. In fact, I was getting carpal tunnel. There was so much lag and un-responsiveness, my hands started to hurt. I stopped wasting my time to get this thing to work with Linux and decided to ONLY use this under Windows 8.

I understood I bought a Windows 8 device.  OK, that is fine with me. I'll give up using this device under Linux for the time being.



Once in Windows 8, it was no different. The gestures still lagged. Movement and actions stuttered. The zooms was no where as smooth as I am used to on my Macs. There were lots of accidental presses and I either logged myself or changed my volumes/mute. It was very frustrating to use as I would always reach out to use another mouse or my laptop's internal trackpad.

The only real things I could do in Windows 8 did not impress me. I could swipe tiles, get into desktop, etc. But where is the real stuff like rotating images? Using Bing's maps, the zoom was horrific. I had to fix the accidental scrolls with another mouse.

Most of the gestures are either swipes (multi-fingers). There are no 3,4 finger pinch. There are no differentiation from using an index finger or thumb. How dumb is that!
Page forward? App reveal? Volume? Lock Screen? Page Up and Down? I could already do this with my keyboard! What about switching workspace? Or better yet, switching between open programs?

Edge swipes to pull up the charms bar? For real? Is this what multi-gesture means in Windows? And the gestures were inconsistent. Some apps complied with the page forward/reverse and some didn't. I speaking mostly of browsers here. Even the built in apps had poor gestures. Image Viewer in Windows doesn't navigate across thumbnails an no ability to rotate an image.

Maybe the Logitech trackpad will fare better. So far, my impressions of multi-gesturing trackpads under Windows or even Linux is not so good.

Now back to the manual. Compare this.



To this on OSX. This is how you learn to use gestures. The system preference has video examples of all the cool tricks you can do.




Compared to the Magic Trackpad.

Simply, there is no comparison. Everything works pretty fantastical out of the box with the Magic Trackpad under OSX. The gestures are so smooth and damn intuitive. They change your way of using a computer. The Lenovo trackpad just gives me carpal tunnel.

Here is my conclusion: Do not even waste $20 on this. I'm going to try and tweak Ubuntu a bit more to get gestures. At least Chrome, Gimp, and LibreOffice allows me to zoom.

Two week Update:

So this is what I've ended up using with this trackpad. My trusty Microsoft trackball for everything and trackpad for zooming. I didn't feel like throwing it away, so I'll try to keep it around and see if I end up liking it later on.

Wednesday, March 13, 2013

Pimp and personalize your Terminal Prompt



Around 16 years ago during the dot-com boom, I was getting my first exposure to remote console access.  Logging into a UNIX server back in those days was a real treat. It had much more intimacy as sysadmins would often personalize their lair.
Today, with Puppets, Chefs and virtualization, scores of machines and servers are created on-the-fly. Virtualization and cloud computing has desensitized the experience.

Today, I don't even know what I'm logging into. Single VM instances run small web applications unlike before when a massive server would handle a variety of tasks. This is what I typically see:


Which brings me to today's blog post. Personalization in the console. With things like ASCII art, MOTDs, and even editing bash profiles, you can bring some of that intimacy back.

Now, doesn't these screenshots below look more personal.





MOTD (Message of the Day) is a text file sysadmins usually personalize for end users login in. Today, MOTDs are often system auto-generated to display stats.
You can re-claim that back rather easily. Or, you can append to the default MOTD by adding a file /etc/motd.tail on most *NIX operating systems.

I normally head over to several ASCII sites and download some goofy ascii art to give the servers some more bling.





Some interesting tools.

There are a few things in Linux you can use to customize your MOTDs.

First, there is linux_logo (apt-get install linux_logo on Debian or pacman -S linux_logo on arch).

This will give you the ability to generate a few great system logos.

To list available logos, type in: linux_logo -L list

Then to choose, type linux_logo -L X (number from the list)





If you want to pipe it out to a text file, you can do: linux_logo -L 26 > ubuntu.motd.txt

Another tool is figlet which is an ascii text banner creator. Figlet is pretty straightforward and instructions in the man pages is to the point.

Here, I have a centered logo with a slight slant:
figlet -cf slant "my text"
-c = center
-f = format




Now combine the some ascii art with ascii text decorations, you can have something like these:








As you can see, with little effort, you can stylize your terminal login prompts.






















Monday, March 11, 2013

VirtualBox Headless Server vs Vmware ESXi

 I've started to notice a few twitter and blog posts about running VirtualBox headless as a VM server. In short, have a dedicated machine to host and run VM guests that can be managed via a web console.





Well, there is no such thing as a VirtualBox server. VirtualBox is a Type 2 Hypervisor that runs as an application in a hosted operating system.A true virtualization server would be a Type 1 variety like VMware ESXi or Citrix XenServer. However, that hasn't stop many people from running VirtualBox headless with a web based front end management tool.

In fact, in certain instances, it is a great way to recycle old machines.  Some Type 1 hypervisors have certain hardware requirements that exclude a large number of older machines. For example,VT-x and certain virtualization features of the CPU and chipset are absolute requirements. VirtualBox tends to be more forgiving. I have quite a few old Dell rack servers (1950,2850,2950s) that don't quite meet many of the VMware HCL (Hardware Compatibility List). In fact, depending on the generation, a few of them wont even install ESXi 3 or 4. Hence, despite what people say, you can run VirtualBox as a headless VM server.

There are plenty ways of setting up a VirtualBox server. The most likely way is to install a minimal footprint Linux distro like CentOS, Debian or Ubuntu and install PHPVirtualBox. PHPVirtualBox is a PHP-based web base front end that employs AJAX and PHP to manage VirtualBox.


Here are some relevant links:
https://code.google.com/p/phpvirtualbox/

A step by step how-to:
http://www.howtoforge.com/managing-a-headless-virtualbox-installation-with-phpvirtualbox-on-nginx-ubuntu-12.04

I have a few headless VirtualBox headless machines under Debian and they work quite good for their intended purposes. I run low-level, non mission critical things like Squid, Nagios, and other  network/intrusion monitoring systems.

Benefits of VirtualBox headless over something like ESXi.

The key gain with VBOX (VirtualBox) is familiarity and cross platform. VBOX is free and works across platforms - Linux, OSX, Windows. You don't even have to run a Linux host. You can choose an old MacMini with OSX if you like. You can download images, build appliances and they pretty much work on any machine by copying the files. Most of the people I know who do desktop virtualization use VirtualBox because it is free and cross platform.

You get to test and stage your VM guests on your workstation or laptop. You can build your great web LAMP app on your laptop and easily deploy by copying via something simple as a USB stick. You can simply SSH into your VirtualBox host, mount the drive and copy your files and be ready in a few minutes. When you have 10-20GB VM disks, it is faster to sneakernet the files via USB than over the internet. ESXi does not recognize inserted USB devices so you have to remotely copy files over to your VMFS data-stores. This requires setting up NFS/iSCSI shares , SFTPing your files, or use the Windows application to upload your files. For a non-window user, this is a hassle. In short, I find it easier to get VMs loaded onto the VirtualBox.

Next, the front end is standard web interface and works on phones and tablets using any modern browser. The web app is amazingly well done. You can build VMs from scratch, clone guests, start and stop VMs. If you are familar with the VBoxManage terminal commands, you can SSH into to your host server and manage from the console quite easily. I teach junior developers and have a VBOX machine loaded with a bunch of turnkey LAMP iso. They get to learn to install/build lightweight Linux servers using the web browser interface to VirtualBox.

I also like the different networking options of Virtual Box (bridge,nat,host-only).  Unlike ESXi, your guests can run under NAT mode; meaning they do not require a dedicated IP or actual access to a network interface.  This is handy if you are running something like NAGIOS that doesn't need to be access by the outside world. Nagios works fine behind a NAT. Lastly, the biggest advantage is RDP (Remote Desktop Protocol) console access. I don't need a dedicate app to access the desktop/console of my guest machine. I can use any RDP applications including those found on smartphone and tablets.

ESXi is not as easy to use as VirtualBox. Datastores reside on VMFS (VMWare File Systems). If the ESXi box dies, you can only access the contents of the disk from another ESXi machine that can read VMFS. You can do FUSE-VMFS but I won't go there. With VirtualBox, you simply pull the drives to another machine with similar OS or File-system access. Backups with VirtualBox can be easily automated by the host OS. I can use rsync to copy images to remote backups easily.I'm certain VMware has some nice enterprise features for cloning/migration/etc but my post is intended for those who want to consider using the free version of ESXi.

Another big negative is managing ESXi requires a Windows machine with a dedicated VMware View application. In fact,I manage my ESXi server via Windows 98 running inside VirtualBox. I rarely use Windows and prefer not to boot out of Linux/OSX into Windows 7 just to use one application.


Now for the advantages of ESXi over VirtualBox (headless).

ESXi is a Type 1 baremetal hypervisor. It runs its own small OS that can be booted off a small USB stick. The OS is minimal and its only job is to run Virtual Machines. You don't get the overhead layer of running a host operating system. It runs much much faster without that extra layer of complexity found in Type 2 hypervisors like VirtualBox. On average, my ESXi baremetal OS consumes like 40-80 MB of RAM. The rest of the RAM are dedicated to guests VM and some overhead to manage them. Did I mention it was a small footprint? The whole server can be installed on a flash card or USB stick. It takes a total of 10 minutes to install and get ESXi up and running. With VBOX headless, you have to install the host OS, harden it, install LAMP, set permissions and modify a bunch of config files.

Most importantly, ESXi is much faster than VBOX. There are countless benchmarks on the internet if you care to look.VT-D hardware access if your hardware supports it. You can dedicate physical hardware to guest OS. For example, you can install a Windows guest to access a physical GPU video card. In short, you can run a graphical OS like Windows with hardware acceleration to a large monitor from your "headless" server. All of my experiment with VBOX headless were for low volume material. I would not entrust running a high volume web server off VirtualBox. With ESXi, I would not hesitate to use it for production.

I wont go into the hundreds of reasons why ESXi is better than VirtualBox (e.g. setting resource pools,etc) but the key thing for me is the reporting and statistics. The reporting allows me to examine my guests performance and tailor and allocate resources for their consumption needs. Before, I was allocating 512MB, 1 GB or 2GB of RAM to various "lightweight vms" in VirtualBox and had to constantly log into their consoles to monitor their performance needs. With ESXi, I can graph and visualize their needs after a few benchmarks/testing. For example, with one particular VM guest, I found out all I needed was 384MB ram and 2 CPU vs 1024MB and 1 CPU based on extended analysis.




The screenshot shows a typical scenario on how I may benchmark and prep my guest VM. This particular one is a small web app that serves 5 users and generates PDFs. My test consisted on running several concurrent hits and measuring how long it would take to generate 1500 PDFs. I was able to see the effects of different CPU and RAM settings effected my performance. In this particular example, 768MB and 2 cores was the sweet spot ( vs 2 cores/2GB RAM  or 4 core 512MB). You simply can't do this with VirtualBox.

There are also good 3rd party tool and apps with ESXi. The iPad is handy as well when used with the mobile access appliance. It is good for getting an overall picture of your host and guests. If I had the Vsphere license, I figure I could probably do a bit more.






There you have it. My thoughts on running VirtualBox headless as a VM server. I hope you enjoy the insight.