With this post I start a new series with short tips about tools and frameworks. My main motivation is to add a “safety net” to my OneNote notebook full of notes and, who knows, maybe they are useful to others as well.
Oracle VM VirtualBox
Through the command-line you can issue a number of commands that can be useful for advanced users. (For the rest of the post let’s assume you are in a command prompt where VirtualBox is installed.)
Headless VMs
You can use command-line to start a VM in headless mode (you will need to enable remote desktop to access it, be warned!):
VBoxHeadless -startvm <vm-name>
You can also save the state of a running VM using the following command:
VBoxManage controlvm <vm-name> savestate
(Use double quotes to surround the VM name if it has spaces.)
Clones
If you have a local disk and want to add a copy of it (very copy-paste approach), in older VirtualBox versions you can reassign a disk Id:
VBoxManage internalcommands sethduuid <file>
(That one is for older versions really – today you can create clones directly from UI.)
To create a clone from the command-line (why not? you can use this in a setup script):
VBoxManage clonehd <file-in> <file-out> -format VDI|VMDK|VHD|RAW
(Output format is optional, but useful if you plan for a later export to another tool.)
Short recipe for installing Guest Additions on Fedora 15
This is my short recipe for installing Guest Additions on Fedora 15:
su - yum -y update kernel yum -y install kernel-devel kernel-headers dkms gcc gcc-c++ reboot
And, after reboot is completed:
su - cd /media/VBOXxxxxx sh ./VBoxLinuxAdditions.run reboot
One of the good things of Guest Additions is that you can share a folder with the host computer. To enable that, first add the share through VirtualBox UI, take note of the share name and then:
mkdir <where-to-mount> sudo mount -t vboxsf <share-name> <where-to-mount>
To dismount the share, do as you would do with any other:
sudo umount <where-to-mount>
More about Guest Additions in the following pages: