Snapshots

Full copies of volumes and VM disks, taken while in use.

Overview

A snapshot is a full copy of a volume or a VM’s disk at one moment, taken while it is in use. New volumes and VMs can start from it.

When to use it

  • Before an upgrade, to go back.
  • To copy a VM you set up once.
  • To keep files from a certain day.

How it works

QMP drive-backup
A running VM’s disk is copied to a new qcow2 without pausing it.
qemu-img convert
An idle disk is copied as a file.
Archive copy
A filesystem volume is mounted read-only in a short-lived container and streamed out as a tar.

Snapshots are files in the machine’s data directory. A volume or VM made from one is a full copy, so the snapshot can be deleted afterwards.

Architecture

Snapshots architectureA snapshot copies a disk or folder; new volumes and VMs start from it.full copystart fromVolume or VM diskin useSnapshotfile in the data directoryNew volume or VM
A snapshot copies a disk or folder; new volumes and VMs start from it.
  • Volume or VM disk to Snapshot: full copy
  • Snapshot to New volume or VM: start from

Flows

Cloning a VM

  1. Set up a VM once and take a snapshot.
  2. Launch new VMs from the snapshot; each gets a full copy of the disk.

Set it up

In the console

  1. Open a volume or VM and choose Take snapshot.
  2. Name it.
  3. From the snapshot, choose Create volume or Launch VM.

With the CLI

enclave snapshot create media-before --from volume/media --wait

With OpenTofu

OpenTofu configuration
resource "enclave_snapshot" "media_before" {
  name   = "media-before"
  source = "volume/media"
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_snapshot
NameTypeUseWhat it does
nametextrequiredName of the snapshot: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the snapshot.
sourcetextrequiredWhat to copy: volume/NAME or vm/NAME.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
idtextoutputResource ID.
size_bytesnumberoutputSize of the copy on the machine's disk.
taken_attextoutputWhen the copy was taken (UTC, RFC 3339).
typetextoutputdisk or filesystem.

Limits and security

Good to know

  • A snapshot takes as much disk as what it copies.
  • It stays on this machine; use backups to keep copies elsewhere.

Security

  • Snapshot files are readable only by EnclaveStack (mode 0600).