+++ Thursday 10 April 2025 +++ Snapshot and rollback of virtual machines ========================================= FreeBSD combines the power of bhyve, the hypervisor/virtual machine manager, with the power of ZFS. bhyve and vm-bhyve ------------------ Bhyve, the FreeBSD hypervisor/virtual machine manager is a very efficient hypervisor. vm-bhyve is a management system for FreeBSD bhyve virtual machines. It simplifies the creation, use and management of bhyve virtual machines. ZFS snapshot and rollback ------------------------- ZFS provides the wonderful technology to take snapshots of ZFS datasets. A snapshots is a read-only copy of the dataset. Initially, a snapshot doesn't consume additional disk space. Only new changes, the difference between the actual dataset and the snapshot, are stored. The creation of a snapshot is practically instantaneous. Snapshots can be cloned, and can be transferred to other locations, either locally or remote. Cloning and transferring are wonderful and very useful options. Another very useful option is the rollback of a snapshot. A rollback discards all changes in the dataset since the creation of the snapshot and reverts it to the state at the time the snapshot was taken. VM snapshot ----------- vm-bhyve is designed work with ZFS. It creates ZFS datasets, and supports the use of snapshots and rollbacks. First, create a new virtual machine, install and configure the operating system on it, and perhaps additional packages. Shut the virtual machine down and create a snapshot of it. The snapshot can be used in several ways. Cloning the snapshot creates practically instantaneous a similar virtual machine, and the snapshot can be send to a different location either as a backup or as a method to create a simular virtual machine locally, or on a remote host. VM rollback ----------- First, create a new virtual machine, install and configure the operating system, and perhaps additional packages. Shut the virtual machine down and create a snapshot of it. Start using the virtual machine, f.e. for testing purposes. Install packages, make use of the software, and so on. When done, shut the machine down and issue a rollback. Again, performing a rollback is instantaneous. The virtual machine is rolled back to its pristine state at the time the snapshot was taken. Start the virtual machine, use it, shut it down, and rollback again. This process can be repeated as often as needed. New snapshots ------------- As the virtual machine ages, maintenance becomes important. an upgrade might be needed. or a change in the configuration. Start the virtual machine, perform the maintenance, shut it down and create a new snapshot. This new snapshot can be used just like the previous, either to rapid deployment of similar virtual machines or for temporarily use (e.g., for testing) followed by a rollback. Happy vm-ing! Last edited: $Date: 2025/04/10 15:56:12 $