Snapshots, backup and migration
This chapter covers protecting a virtual machine's data and moving virtual machines elsewhere: snapshots and rollback, clones, exporting a disk as an image, moving between storage pools, migrating to another keelOS host, and moving in from other systems. The click-by-click steps are in Virtual machines; here is what each is good for and where its limits are.
| You want | Use | Where |
|---|---|---|
| A way back before changing the system or installing software | Snapshot, rollback | the Snapshots card on the detail page |
| Another machine like one you have set up | Clone | Clone, Clone from here |
| A disk as an image you can use again | Disk export | command line keel vm export |
| Another storage pool on the same host | Move | Move to another pool |
| Another keelOS host | Migration | the keelMGR manager, or the command line keel vm migrate |
| Machines from ESXi, Proxmox VE, vm-bhyve | Import | Import from ESXi / Proxmox…, the migration source on the Storage page |
1. Snapshots
A snapshot captures all disks, the configuration (config.json) and the UEFI variables of a machine at one moment (the vTPM state included), without memory. It is a ZFS snapshot: it is taken in an instant, takes almost no space at first, and grows as the disks change afterwards.
- Where: the Snapshots card at the bottom of the detail page: fill in Name (and an optional Note) and click Take snapshot. Each snapshot in the list shows Taken, Then (whether the machine was running or off), Space, and Roll back, Clone from here, Delete. The steps are in Virtual machines §6.
- While it runs: possible; the result is crash-consistent, as if the power had been cut at that moment (the list marks it as such). For databases and the like, stopping the service or shutting the guest down first is safer.
- Roll back: back to the moment of the snapshot; what was written to the disks and changed in the settings since is gone, and newer snapshots are deleted with it (the dialog lists them). A running machine is powered off first; the dialog offers Shut it down cleanly first (else off at once) and Start it afterwards.
- Delete: a snapshot that linked clones still use (it says linked clones use it: …) cannot be deleted; delete the clones or make them full copies first. Snapshots keel took for a clone are marked taken for a clone.
On the command line (see The keel command line):
keel vm snapshot [--note NOTE] ID NAME
keel vm snapshots ID
keel vm snapshot-delete ID NAME
keel vm rollback [--force] [--shutdown|--stop] [--start|--no-start] ID NAME
--force allows deleting newer snapshots; --shutdown shuts the machine down cleanly first, --stop cuts the power.
kcell applications have their own snapshots, taken automatically before updates and every day; see kcell applications.
2. Clones
A clone makes a new machine from a machine's present state (keel takes a snapshot first) or from one of its snapshots:
- Linked: done at once, shares data blocks with the snapshot and only takes space for what changes; while the clone exists that snapshot cannot be deleted.
- Full copy: copies the disks in full; independent of the source, and takes as long as copying the disks.
A clone gets a new UUID, MAC addresses and console ports, does not start automatically and has no RDP password; its vTPM is new by default (tick Copy the vTPM for the same identity); passthrough devices are copied, and whichever of the two starts first gets the device.
keel vm clone [--from SNAPSHOT] [--full] [--keep-tpm] ID NEWNAME
Note: linked clones, and machines that still have linked clones, cannot move to another storage pool (§4): make the clone a full copy first, or delete it.
3. A snapshot is not a backup
Snapshots live in the same storage pool as the machine: if the pool's disks fail, the snapshots go with them. Protection against a failed disk comes from the pool's own redundancy (a mirror); see Storage.
1.0 has no built-in scheduled backup and does not copy machines to other disks or hosts on its own. What you can do now:
- Back up inside the guest: use the guest's own backup software (Windows Backup,
rsync,resticand so on) to a NAS, for example a share on the NAS. This is the most reliable way, and restoring does not depend on keelOS. - Keep a copy on another storage pool: when the host has two pools (on different disks), Clone the machine as a Full copy, then Move to another pool (§4) the clone. The copy has its own UUID and MAC, does not start automatically, and can be started if the original is lost.
- Export a disk: make an image file of a disk of a stopped machine (§5).
Not supported in 1.0: scheduled snapshots of virtual machines, scheduled backup or replication to another host, snapshots with memory.
4. Moving to another storage pool
When the host has two or more storage pools, the detail page has Move to another pool: the machine's whole dataset (disks, snapshots, checkpoints, UEFI variables) is copied to the other pool, verified, and the old one deleted.
- Stopped, suspended and running machines can all move. A running one keeps running while it is copied; the final switch pauses it for well under a second.
- Choose the pool under To pool and click Move; pools without enough space are greyed out with the reason. Progress shows under Moves between pools on the detail page.
- Cannot move: linked clones and machines with linked clones (§2), and keelOS's own instances (keelNAS, keelAuth and the like, whose system disks are clones of a market image). A kcell moves only while it is stopped.
Command line: keel vm move ID POOL. Creating pools is in Storage.
5. Exporting a disk as an image
keel vm export ID DISK NAME.img
Copies a disk of a stopped machine (DISK is the disk's id under disks in config.json, for example disk0) into a raw image in the ISO images list under Configuration → Storage. The machine cannot start during the export. Afterwards you can:
- choose disk image (as the system disk) under System from when creating a machine, to use it as the first disk;
- for a stopped machine, click Write it over the system disk beside the system disk under Storage on the edit page, to replace that disk with it.
Not supported in 1.0: exporting a disk in the web page, and downloading an image from the web page to your own computer.
6. Migrating to another keelOS host
A machine can move from one keelOS host to another. In 1.0 this is a cold migration:
- The disks are copied over the network in rounds while a running machine keeps running;
- when few changes are left, keel shuts the machine down (as Shut down does) and sends the last changes;
- it starts on the target host (if it was running before).
The downtime is usually the time the guest takes to shut down and start again. Configuration, UEFI variables and the vTPM go with it, and the MAC addresses stay the same.
How to start one:
- The keelMGR manager (recommended): tick the machines in the manager and choose the target host. Before migrating it runs a pre-check (name or MAC conflicts, enough space, matching networks on the target); NICs are matched to networks by name, and by VLAN when the names differ.
- The command line:
keel vm migrate ID --to https://TARGET --token TOKEN --fingerprint FINGERPRINT, with a migration-only token issued on the target host.keel vm migrationslists migration jobs and kept copies.
During and after:
- Both hosts' machine lists show the progress: the source says migrating to …, the target lists it as coming in.
- After the move, the source keeps its copy for 24 hours by default, listed under Migrated away (…; kept for a rollback). During that time Roll back (command line
keel vm migrate-rollback ID) brings the machine back to the source: the copy on the target must be shut down first, and changes made there are not brought back. - Machines with passthrough devices migrate too, but do not start on the target by themselves: the devices may be different ones on that host, so choose them again or remove them in the settings (the detail page says so). The same applies when a network or ISO is missing on the target.
- When it fails or is cancelled midway, what the target received is deleted; if the machine had already been shut down for the last round, it starts again on the source.
Not supported in 1.0: live migration (changing hosts without shutting down); starting a migration from a single host's own web page (use the manager or the command line); keelOS's own instances (keelNAS, keelAuth, the manager and so on) do not migrate.
7. Moving in from other systems
- ESXi or Proxmox VE: click Import from ESXi / Proxmox… on the machine list, connect to the old host and tick the stopped machines to copy; nothing changes on the old host. See Virtual machines §13.
- vm-bhyve on FreeBSD: import the old system's pool with Import read-only, as a migration source, find the machines on the pool's card, tick them and copy them to a keel pool. Not a byte of the old pool is written. See Storage.
- Ready-made disk images (
.img,.qcow2,.vmdk): choose disk image (as the system disk) when creating a machine and upload it; keel converts.qcow2and.vmdkto.img. See Virtual machines §2.2.
Imported machines never start by themselves. Where the copy has the original's MAC addresses (ESXi and Proxmox imports keep them), do not run the original and the copy on the same network at the same time.