Additional to my daily job, I need to “play” from time to time in my home server, it’s a quad core machine with 8 gigs of RAM and two hard drives, nothing special about it, the important thing is that it does the job.
About 8 month ago I upgraded the OS and VMWare server started to “complain”, specially the graphical interface, it was discontinued and almost dead, so I decided to move to VirtualBox, I also updated the OS to Oracle Linux 6.
I’m surprised on how complete VirtualBox is and the multiple configuration options available, the graphical interface just doesn’t make justice to the product.
I started creating virtual machines to test my new toy and I realized that when the virtual machines are started from the graphical interface (I use gnome) they have a “collateral” impact on the host performance, having that GUI interface sitting there cost cpu and memory, after that I understood the importance on correctly setting the “VRDE” (Virtual Box Remote Desktop Extension), let me tell you something, it really rocks.
VRDE allows you to connect to your machines, linux, windows or whatever, using your normal Windows remote desktop connection, is a true console that works even if the virtual machine you are connecting to have no network.
I want to share with you a script that I developed using bash shell scripting to control machines on VirtualBox 4, I call it vbctl (VirtualBox control), and it really helps controlling the machines states (startup, pause,shutdown ,save state, etc).
– It will scan the virtual machines in the system and list them (screenshot 1).
– It will allow you to perform operations on them (screenshot 2).
– Designed for headless machines, it will only start headless machines and it will show the RDC port (VRDE Port) in the listing (screenshot 1).
– VRDE activation, if you start a machine with VRDE disabled it will enable it and ask for a port number (between 5000 and 5050).
I want to state that this is not an intelligent script, it will do whatever you ask it to do (with some minor exceptions), for example, it will allow you to shut down a machine that’s already down.
– Create a directory (with the virtualbox administrator user).
– Save the script as vbctl.sh
– chmod 740 vbctl.sh
– edit your .bash_profile and create an alias (optional)
One last thing, if you improve this script please share it back!
Well, the OperSource spirit arrived sooner than I expected.
In less than two weeks I received the first important improvement!
- V1.3 can now be downloaded from here
Mr. João Figueiredo improved the visual presentation and added colors! he also fixed minor problem when Virtual machine names have spaces.
Version 1.2 is still available for download.