---
title: "Persistence"
url: https://www.daytona.com/compute-glossary/sandboxes/persistence
---

# Persistence

Part of the [Compute Glossary](https://www.daytona.com/compute-glossary.md), section [Sandboxes](https://www.daytona.com/compute-glossary/sandboxes.md).

Also called Durability, Persistent storage.

Persistence is the keeping of a machine's data or state after the machine stops, restarts or moves to other hardware. A persistent machine comes back with the files and settings it had, while an ephemeral one starts fresh every time. Persistence comes in degrees, from keeping only the disk to keeping the full running memory. Each step up costs more to store and promises more to the program on the far side of the gap.

Persistence decides what a workload can rely on between runs. Without it, every installed package and written result has to be rebuilt or copied out before the machine goes away. Software built for ephemeral machines treats the disk as scratch and keeps anything important in an outside service. Software that assumes persistence, such as a tuned developer setup, breaks quietly when its files vanish.

Keeping state has a price, because disks and memory images take up storage while the machine sits idle. Restoring that state can also make a start slower than booting a clean machine from its image. A platform with many idle machines can end up paying more to store their state than to run the active ones. Some platforms therefore move state that sits unused to cheaper storage until the machine is needed again.

## Ephemeral and persistent machines

Ephemeral machines are machines whose disk is discarded when they stop, so each start begins from the same image. Persistent machines keep their disk, usually on [block storage](https://www.daytona.com/compute-glossary/storage/block-storage.md), and find it unchanged on the next start. An ephemeral machine may still write to its disk while it runs, but those writes vanish with it. Many ephemeral designs keep the image read-only and send all writes to a copy-on-write layer that is thrown away at the end.

Stopping and deleting are different events on a persistent machine. A stop ends the processes and frees the processor and memory, while the disk stays. A delete removes the disk along with the machine. A stopped machine can therefore start again on a different host, as long as that host can reach the disk. Its storage keeps costing money until the delete, even though nothing runs.

Ephemeral machines suit work that must start clean each time, such as tests or [untrusted code](https://www.daytona.com/compute-glossary/agents/untrusted-code.md). Persistent machines suit long-lived development environments, where rebuilding the setup on every start would waste minutes. Starting clean also removes any doubt about leftovers, since nothing from one run can reach the next. A persistent machine slowly drifts from its image as packages and files pile up, which makes problems harder to reproduce.

| **Event**   | **Running processes** | **Memory** | **Disk** |
| ----------- | --------------------- | ---------- | -------- |
| **Restart** | Lost.                 | Lost.      | Kept.    |
| **Stop**    | Lost.                 | Lost.      | Kept.    |
| **Pause**   | Kept.                 | Kept.      | Kept.    |
| **Delete**  | Lost.                 | Lost.      | Lost.    |

## Memory persistence

Memory persistence is the keeping of a machine's running state, its memory and processor registers, rather than only its disk. A paused machine keeps that state in host memory, and a memory [snapshot](https://www.daytona.com/compute-glossary/sandboxes/snapshot.md) writes it out to storage. A pause stops the [vCPUs](https://www.daytona.com/compute-glossary/virtualization/vcpu.md) but leaves every page in place, so the machine still holds its memory on the host. Once the snapshot is written and the machine is stopped, the host can give that memory to other machines.

Resuming from saved memory brings back running processes and their open files exactly as they were. A program does not notice the gap, apart from a jump in its clock and any network connections that timed out. The state of virtual devices is saved too, so a disk or network card resumes exactly where it left off. Software that caches the time or holds short-lived tokens may still need to refresh after a long gap.

Memory images are as large as the memory the machine uses, so they cost more to store than a disk alone. Loading them on demand, page by page, keeps resume fast at the cost of slower first accesses. Hosts shrink images by leaving out pages the guest never touched and compressing the rest. A machine that sleeps for long stretches may be cheaper to boot fresh than to keep as a full memory image.

## Volumes

Volumes are units of storage that exist apart from any one machine and attach to it as a disk or a mounted directory. Deleting the machine leaves the volume and its data in place. A volume has its own name and lifetime, and the platform tracks it as a resource of its own. It can sit unattached for a long time, waiting for the next machine that needs its data.

A volume lets a new machine pick up the data an older one left behind, such as a dataset or a build cache. Some volumes attach to one machine at a time, while shared ones mount on many machines at once. Shared volumes usually work as a network file system, which coordinates writes between machines. Single-attach volumes behave like a plain disk and run faster, but only one machine at a time sees the data.

Volumes separate the life of the data from the life of the machine, which makes machines cheap to throw away. The cost is [latency](https://www.daytona.com/compute-glossary/foundations/latency.md) on every access, because most volumes live on separate storage servers. A workload can keep hot files on its local disk and use the volume only for what must survive. Backups still matter, since a volume deleted by mistake takes its data with it.

## Related terms

- [Snapshot](https://www.daytona.com/compute-glossary/sandboxes/snapshot.md)
- [Block storage](https://www.daytona.com/compute-glossary/storage/block-storage.md)
- [Local disk](https://www.daytona.com/compute-glossary/storage/local-disk.md)
- [File system](https://www.daytona.com/compute-glossary/storage/file-system.md)
- [Lifecycle](https://www.daytona.com/compute-glossary/sandboxes/lifecycle.md)
