Skip to content

Storage / Task

Create and protect a snapshot

Updated · 3 min read

Take a crash-consistent snapshot of an available or attached volume, wait for it to complete, and protect it so it can be used as a clone source.

On this page5 sections

Take a snapshot to capture a volume’s data at one point in time. Protect it when you want to create volumes or images from it. You don’t have to detach a volume to snapshot it.

Before you begin

Create the snapshot

  1. If the volume is attached to a running instance, quiesce the filesystem inside the guest when you need more than crash consistency. The snapshot is taken while the instance runs and captures the disk as a sudden power-off would.

  2. Create the snapshot.

    terminal
    origin storage create-snapshot --volume-urn <volume-urn>

    With the API, use the createSnapshot mutation:

    GraphQL
    mutation {
      pvs {
        createSnapshot(input: { volumeUrn: "<volume-urn>" }) {
          urn
          status
        }
      }
    }

    The snapshot reports PENDING. Note its urn.

  3. Check the snapshot until it reports status: COMPLETED.

    terminal
    origin storage get-snapshot --snapshot-urn <snapshot-urn>

    If it reports ERROR, the copy failed. Delete it and take a new one.

Protect the snapshot

Protect the snapshot only after it reports COMPLETED. A protect request for a PENDING snapshot is refused, not queued.

  1. Protect the snapshot.

    terminal
    origin storage protect-snapshot --snapshot-urn <snapshot-urn>

    With the API, use the protectSnapshot mutation:

    GraphQL
    mutation {
      pvs {
        protectSnapshot(input: { snapshotUrn: "<snapshot-urn>" }) {
          accepted
          message
        }
      }
    }
  2. Check the snapshot until it reports protectionStatus: PROTECTED.

    terminal
    origin storage get-snapshot --snapshot-urn <snapshot-urn>

    If it reports FAILED, the protection state is unknown. Protect it again. See Snapshot states.

The snapshot is now a clone source: status: COMPLETED and protectionStatus: PROTECTED.

Next steps