Skip to content

Create and use snapshots

This guide shows you how to create snapshots from disks, create new disks from snapshots, and manage snapshots using the evroc CLI and API.

  • evroc CLI installed and configured
  • At least one existing disk in your project

You can create a snapshot from any existing disk. The disk can be attached to a VM or detached, and the VM can be running or stopped.

Important: You can create a snapshot while the VM is running, but there’s a risk the snapshot may be corrupted if the guest OS is writing to the disk. To minimise this risk, if this is a data disk, use fsfreeze inside the VM to quiesce the filesystem before creating the snapshot. Do not freeze your boot disk - this is very dangerous and will break your VM. To use fsfreeze:

Terminal window
sudo fsfreeze -f /mnt/mydisk
# Create the snapshot here
sudo fsfreeze -u /mnt/mydisk
Terminal window
evroc compute snapshot create mysnapshot \
--disk-ref=my-disk
Terminal window
curl -X POST https://api.evroc.com/compute/v1beta2/projects/{projectID}/regions/{regionName}/snapshots \
-H "Content-Type: application/json" \
-d '{
"metadata": { "name": "mysnapshot" },
"spec": {
"diskRef": "/compute/projects/{projectID}/regions/{regionName}/disks/my-disk"
}
}'

See Create a Snapshot in the API reference.

List all snapshots in your project:

Terminal window
evroc compute snapshot list

Use evroc compute snapshot get <snapshot_name> for detailed information, including restoreSize and creation time.

See List Snapshots in the API reference.

You can create a new disk from any existing snapshot. The new disk is created in the same zone as the snapshot.

Create a disk from a snapshot using the CLI

Section titled “Create a disk from a snapshot using the CLI”
Terminal window
evroc compute disk create mynewdisk \
--snapshot=mysnapshot \
--zone=a

If you don’t specify a disk size, it defaults to the snapshot’s restoreSize. If you specify a size, it must be greater than or equal to the restoreSize.

Important: If the new disk has never been attached to a VM, the snapshot you created it from can’t be deleted until the disk is deleted.

Create a disk from a snapshot using the API

Section titled “Create a disk from a snapshot using the API”
Terminal window
curl -X POST https://api.evroc.com/compute/v1beta1/projects/{projectID}/regions/{regionName}/disks \
-H "Content-Type: application/json" \
-d '{
"metadata": { "name": "mynewdisk" },
"spec": {
"source": {
"type": "snapshot",
"snapshotRef": "/compute/projects/{projectID}/regions/{regionName}/snapshots/mysnapshot"
},
"placement": { "zone": "a" }
}
}'

See Create a Disk in the API reference.

Delete a snapshot you no longer need. The snapshot can’t be deleted if a detached disk was created from it.

Terminal window
evroc compute snapshot delete mysnapshot

See Delete a Snapshot in the API reference.