VirtualBox offers free virtualization software for Unix systems, and is an excellent way to run instances on which software can be built and tested, or to try out various configurations without the need for physical hardware.
- defaults - default settings I use on virts.
- _VBoxManage is a ZSH compdef for the VBoxManage command.
Backups
Virtual disk images and the snapshot directories should be excluded from backups of the host system, as these large files may change often. Backup the guest filesystems from within the guest, or otherwise ensure that the virtual systems are reproducible under an acceptable amount of time and effort. Backups could be taken of golden immutable images that have had any free space zeroed by the guest OS, then VBoxManage modifyhd --compact used to reduce the size of the image.
System Time
NTP performs poorly on test instances, as the clock will desynchronize at the point the instance is suspended or a snapshot taken. This may cause software build problems, as make(1) or other build software will complain about dates in the future. Either install and configure the appropriate “Guest Additions” for the operating system, if supported, or restart ntpd:
- NTP - kill ntpd, then use ntpdate to force the system clock to the current time, then resume ntpd while the instance is up.
- OpenNTPD - kill ntpd(8) then restart it via ntpd -s to force an immediate clock sync.
A sudo entry could be provided to facilitate daemon restarts, to help eliminate root access to the system:
ALL ALL=(ALL) NOPASSWD: /somewhere/restart-ntpd
Or, setup a periodic task in cron(8) or configuration management software that periodically restarts ntpd.
Running many virtual systems may generate large amounts of NTP traffic. If this is a problem, setup a few local NTP servers, and have the virtual systems peer of those servers.