Save demo's memory and disks as a checkpoint, then restore it as a new
computer, demo-restored. The source stays unchanged. To copy a running
computer's data disks and start from its image, branch it.
You need the CLI installed and signed in, with a
selected workspace where you have the admin or editor role.
Use demo from
Create a computer, and keep the name demo-restored free.
Creating a checkpoint requires an attached data disk and snapshot support. The example writes to your home directory, which lives on that disk. Both depend on the deployment's storage configuration; see Computer lifecycle states.
Save a checkpoint
Check demo before you start:
nevia status demoYou can checkpoint a ready or sleeping computer with no pending transition or
running operation. The file commands need ready, so wake the computer
first if it is sleeping.
Write a small scratch file:
nevia exec demo -- sh -c 'printf "saved\n" > checkpoint-note && sync'Checkpoint creation closes active exec sessions, so finish any exec commands first. Checkpoints are crash consistent: finish and flush the writes you need before capture. A running computer pauses during capture, then resumes. A sleeping computer stays asleep.
nevia checkpoint create -c demo --name before-change --wait
nevia checkpoint ls -c demoFind the before-change row with state ready. The list shows the newest
checkpoints first. Names are labels and can repeat, so status, restore and
deletion take the checkpoint's ID. Copy the full ID from the CHECKPOINT column
and use it in place of 01d4cnjkwhftngfp8vkmp723mhv below:
checkpoint=01d4cnjkwhftngfp8vkmp723mhv
nevia checkpoint status "$checkpoint" -c demoRestore into a new computer
Change the source file after the checkpoint:
nevia exec demo -- sh -c 'printf "changed\n" > checkpoint-note && sync'The checkpoint must be ready. Restore creates a new computer with the captured
memory, disks and configuration, environment included (see
when a change reaches a computer).
demo is untouched:
nevia restore "$checkpoint" -c demo --name demo-restored --wait
nevia status demo-restoreddemo-restored should be ready, with no pending transition.
Compare the files:
nevia exec demo-restored -- cat checkpoint-note
nevia exec demo -- cat checkpoint-noteThe restored computer prints saved. The source prints changed.
Clean up
Delete the restored computer first and wait for the deletion to finish. A live
computer created from a checkpoint blocks deletion of that checkpoint and of its
source, so delete any other restores before you remove the checkpoint.
If you protected demo-restored, clear protection before deleting it.
These commands delete demo-restored and its data, then the checkpoint:
nevia rm demo-restored --yes --wait
nevia checkpoint rm "$checkpoint" -c demo --yes --wait
nevia checkpoint ls -c demoThe checkpoint should be gone from the list. Remove the source's scratch file:
nevia exec demo -- rm checkpoint-noteDeleting demo also deletes its remaining checkpoints, so keep it while you
need those restore points. See Computer lifecycle states
for deletion constraints.
See nevia checkpoint and
nevia restore for command options, or
branch a computer from its data disks.