VBoxTool

VBoxTool – An Incredibly Useful Script

Bash scripting is straight forward. There are logical and object oriented constructs like programs, and you are basically manipulating data contained in files, and using standard output to determine various tasks to be done. VBoxTool does what VBoxManage lacks. I wonder how corporations start virtual machines on boot, and manage their machines once the system is running. They clearly write their own scripts. VBoxTool is a publicly published script that does just this. I would like to extend appreciation to Mark Baaijens for the script; it is extremely useful! It completely manages my system from automating the boot process when I need to reboot the host, saving the machines when the need to be shut down, and backing them up at regular intervals with cron jobs.

http://sourceforge.net/projects/vboxtool/develop

Automatic Actions – Run or Walk Those Cron Jobs

You’d be surprised what you can accomplish when you aren’t even close to your computer. Using Rsync you can completely backup your /home directory. I back it all up, except one directory, which I handle differently.

rsync --exclude="~/.VirtualBox" /home /media/backup

I mount a usb hard drive to /media/backup. Make sure you set proper permissions:

sudo chown user:user /media/backup

Now you can rsync your home directory without the need for a sudo.

Rsync only updates files that have timestamps that are newer than the previously transferred. This makes it fast; real fast!. I backup my machine using an rsync command once a day. Open crontab:

sudo crontab -e

Add a line:

0 0 * * * rsync --exclude="~/.VirtualBox" /home /media/backup

The above will run the command every day at 12 AM. Your /home directory with be synchronized with /media/backup/home.

Then comes your virtual machines. Use Vboxtool!!!! Check out this post for more info about the tool.

Set /media/backup as the backup directory in /etc/vboxtool/vboxtool.conf. Then add the following line as a cron job.

0 1 * * * vboxtool backup WebServer

Replace WebServer with the name of your virtual machine. This cron job will run every day at 1 am.

Extended VirtualBox Management – VBoxTool

VBoxManage, the command line tool of VirtualBox, does its job. It also has its limitations. You can starts, pause, and save virtual machines, but there is no integrated way to automate various processes. To have a virtual machine boot with the host, in headless mode, you would have to create a custom init.d boot script. A great script package, call VBoxTool, coordinates the process into a terminal app. The terminal app refereneces two configuration files in your /etc directory, and utilizes an init script to boot virtual machines. VBoxTool is at sourceforge:

http://vboxtool.sourceforge.net/

Configure the machines you want to boot in:

/etc/vboxtool/machines.conf

Any machine listed in machines.conf will boot with the host. You can view running machines with:

vboxtool showrun

Then you can also view all available machines with:

vboxtool show

Maybe this wrapper script will be integrated into VBoxManage directly; it is clear the features are useful especially for system administrators.

Your Server – The Boot Process

You want to isolate all your server features into background process. You don’t want any server features to be dependent on graphical or client side applications. I previously had my mail server dependent on the client side filtering capabilities of Thunderbird. This was a no no because it required me to maintain a desktop session. This was not optimal because during the day the desktop session was swapped to the hard drive and this caused substantial system lag when coming back to use the desktop. Now with VBoxTool, the web server is automatically booted with the host system, and all functions on the server are consolidated to background processes; there is no more dependency on client side filtering. The MythTV server also boots with the host, and the first screen the host encounters is the GDM login. Now the system is secure. Passwords are required to enter the system as a user.