Disks
Store data that outlives a machine, and grow a machine's storage.
Every machine comes with a writable root disk. Add more disks when data needs to outlive a machine, move between machines, or be copied for a new task.
What you'll learn
- How the root disk works
- How to create, attach, and detach disks
- How to grow and copy a disk
Before you start
The root disk
Metorial creates a root disk for every machine. The machine's file system lives on it, so everything you install or write outside of attached disks ends up here. The root disk:
- Keeps its files when the machine pauses, hibernates, or restarts
- Is deleted together with the machine
- Can't be detached, deleted on its own, or copied
- Can grow with
resize
Find its ID in the machine's root_disk field, or list it with metorial-admin sandbox disks list --type root_fs --machine-id $MACHINE.
Attach a disk
Disks you create yourself exist independently of machines. Delete a machine and its attached disks stay, ready for the next one.
Create a disk
Create the disk in the region your machine runs in. Sizes are in bytes; this one is 10 GiB.
Save the disk ID from the output as DISK.
Mount it into a machine
Pass the disk and a mount path in mounts, either when you create the machine or later:
Mount changes apply when the machine restarts. A running machine restarts on its own; run machines restart to apply the change immediately.
Check the mount
The machine's mounts field shows each disk with its mount path and whether it's mounted.
To detach a disk, update mounts without it. mounts replaces the whole list, so include every disk you want to keep.
Grow a disk
Disks can grow but never shrink. Resizing briefly stops the machines the disk is mounted into, then starts them again.
A resize moves through pending, draining, resizing, verifying, and restarting before it's complete. If it ends failed, retry it with disks resizes retry $DISK <resize-id>.
Copy a disk
clone creates an independent copy of a disk in the same region. Use it to give several machines the same starting data, such as a prepared repository or dataset.
Find disks
disks list also filters by --type, --machine-id, --region, and --search. A disk's machine field shows the machine it's attached to and its mount path.