> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lazycloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Disks

> A named, sized filesystem a pod keeps across restarts, for state that needs a real local disk.

A disk fits state that expects a local filesystem: git repositories,
`node_modules`, databases, package caches. It is ext4 on the machine running
the pod, so file locks, hard links, and `fsync` behave as they do on any Linux
host. A [volume](/concepts/volumes) fits files shared between workloads.

## Declare a disk

```python theme={null}
from lazycloud import App, Disk, Image

app = App("dev")

box = app.pod(
    name="box",
    image=Image(python_version="3.12"),
    command=["sleep", "infinity"],
    disks=[Disk("box-root", size="100Gi")],
)
```

The first deploy creates the disk, and every later deploy that names it gets
the same files. A disk name means the same disk anywhere in the workspace.
`size` takes the units memory does, from `1Gi` to `1Ti`. Deploying a larger
size restarts the pod with the disk grown to it. A deploy with a smaller size
fails, because a disk never shrinks.

`mount_path` defaults to `/`, which makes the disk hold the container's whole
writable filesystem: packages installed with `apt-get`, files in `/root`, and
anything else written outside a volume. The image still comes from the
deployment, so a redeploy with a new image keeps what was written on top of
it. `Disk("cache", size="20Gi", mount_path="/cache")` mounts at one directory
instead.

## How it persists

While the pod runs, LazyCloud copies what changed to your workspace's storage
every two minutes, and once more when the container stops. The next start
restores that copy on whichever machine it lands on, so a disk is never tied to
one machine. A restart within 30 minutes in the same zone skips the download.
A machine failure can lose up to the last two minutes of writes.

One container writes a disk at a time. A pod with a disk runs one container,
and a redeploy's new container waits for the old one to hand the disk over.

## List and delete

```bash theme={null}
uv run lazycloud disk list
uv run lazycloud disk delete box-root
```

Deleting a pod or its deployment never deletes the disk, and deleting the disk
removes everything written to it. A disk in use can't be deleted. The
[storage page](/platform/dashboard) lists disks as well.

## Pricing

Each disk is one line on the Usage page, priced from two rates on the
[pricing page](https://lazycloud.dev/pricing). What the disk stores bills per
GiB-month for as long as it exists, and that can be less than its size. Its
declared size bills per GiB-month for the time a container holds it.

Disks need a paid plan. The plan caps the total declared size of a workspace's
disks, and a deploy past the cap fails with a message naming the cap.
