Skip to main content

Overview

The SnapshotInfo model holds all metadata about a saved VM snapshot. It is returned when you create a snapshot and can be retrieved from the snapshot list.

Fields

snapshot_id
string
required
Unique identifier for the snapshot. Must contain only lowercase letters, numbers, and hyphens. If not provided during creation, SmolVM generates one automatically.
vm_id
string
required
The identifier of the source VM that was snapshotted.
snapshot_path
Path
required
Path to the saved VM state file (vmstate.bin).
mem_file_path
Path
required
Path to the saved memory dump (mem.bin).
disk_path
Path
required
Path to the saved root filesystem copy (disk.ext4).
vm_config
VMConfig
required
The full VM configuration at the time of the snapshot. Used during restore to recreate the VM with the same settings.
network_config
NetworkConfig
required
The network configuration at the time of the snapshot. Used during restore to reattach the VM to its original network identity.
created_at
datetime
required
UTC timestamp of when the snapshot was created.
restored
bool
default:"false"
Whether this snapshot has been restored at least once.
restored_vm_id
string | None
default:"None"
The VM ID of the most recently restored instance, if any.

Usage

Creating a snapshot

from smolvm import SmolVM

vm = SmolVM()
vm.start()

snapshot = vm.snapshot(snapshot_id="my-checkpoint")
print(f"ID: {snapshot.snapshot_id}")
print(f"Source VM: {snapshot.vm_id}")
print(f"Created: {snapshot.created_at}")
print(f"Disk path: {snapshot.disk_path}")

vm.close()

Listing snapshots

from smolvm import SmolVMManager

with SmolVMManager() as sdk:
    snapshots = sdk.list_snapshots()
    for snap in snapshots:
        status = "restored" if snap.restored else "available"
        print(f"{snap.snapshot_id} ({status}) — from {snap.vm_id}")

Restoring from a snapshot

from smolvm import SmolVM

vm = SmolVM.from_snapshot("my-checkpoint", resume_vm=True)
print(f"Restored into: {vm.vm_id}")
print(f"Status: {vm.status}")

vm.close()
Last modified on April 3, 2026