I've done a Perl program that make clones of VirtualBox machines in a fraction of a second.
How can this script run so fast? The reason behind this speed is the teaming of ZFS clone + snapshot commands, and VirtualBox createvm/modifyvm commands.
The benefits are:
- Virtual machine clones are made in less than a second.
- Virtual machine clones take approximately 200 kilobytes (yes, kilobytes ): who knows ZFS can verify my claims...
- You don't have to copy gigabytes of virtual disks back and forth.
- You can make 20 clones in 10 seconds on a mainstream notebook or workstation with OpenSolaris.
- This system is well suited for testing purposes: every virtual machine take only the disk space necessary for the application you have to test.
- ZFS datasets that contains virtual disks can have the compression flag activated: you can spare more near 50% of disk space with no or zero cpu overhead
The program is about 250 lines long and with a reasonable number of comments.
I've done also a remake of Joerg Moellenkamp ZFSviz, to ease the display of parent-child relationships of ZFS dataset.
I'm not a professional developer, only a sysadmin: I ask the forum how is the best way to release these two programs to the public free to use and modify.
Here is the command output (no, it's not a joke)
marco@cypher.csf.it:~/Software/VirtualBox$ /opt/bin/perl zfs_clonevm.pl -s mint7 [mint7] -> [mint7_C000004] Checking snapshot(s)... All checks OK, cloning [mint7] to [mint7_C000004]... Snapshot not specified or non existent: I'll check if filesystem [rpool/export/home/marco/virtual_disks/mint7] has one. Snapshot found. Using snapshot [rpool/export/home/marco/virtual_disks/mint7@20091126]. Clone [rpool/export/home/marco/virtual_disks/mint7_C000004] created.