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

# Share a drive read-only

> Attach the same drive to many sandboxes at once.

A common pattern: one drive holds data or a base layer many sandboxes need to **read**, but none of them need to **write**. Read-only sharing exists for exactly this — no per-sandbox copies, no coordination needed.

## Seed it once

A drive read-only-shared later still needs **writing at least once**, before anything ever attaches it read-only — a read-only mount can't format or write to it.

```bash curl theme={null}
curl -X POST http://127.0.0.1:7777/drives -d '{"size_mib": 512}'
# {"id": "<drive-id>", ...}

curl -X POST http://127.0.0.1:7777/sandboxes \
  -d '{"drives":[{"id":"<drive-id>"}]}'
# attach read-write, seed it, then stop this sandbox (or delete it with ?keep=false)
```

```ts seed.ts theme={null}
import { Drive, Sandbox } from "sandkiln";

const drive = await Drive.create(512);
const sandbox = await Sandbox.create({ drives: [{ id: drive.id }] });
// attach read-write, seed it, then stop this sandbox (or delete it with keep: false)
```

```python seed.py theme={null}
from sandkiln import Drive, DriveAttachment, Sandbox

drive = Drive.create(512)
sandbox = Sandbox.create(drives=[DriveAttachment(id=drive.id)])
# attach read-write, seed it, then stop this sandbox (or delete it with keep=False)
```

```bash CLI theme={null}
kiln drive create 512
# prints the new drive's id

kiln sandbox create --drive <drive-id>
# attach read-write, seed it, then stop this sandbox (or `rm --destroy`)
```

## Attach it read-only, as many times as you need

```bash curl theme={null}
curl -X POST http://127.0.0.1:7777/sandboxes \
  -d '{"drives":[{"id":"<drive-id>","read_only":true}]}'
```

```ts attach-readonly.ts theme={null}
const reader = await Sandbox.create({ drives: [{ id: drive.id, readOnly: true }] });
```

```python attach_readonly.py theme={null}
reader = Sandbox.create(drives=[DriveAttachment(id=drive.id, read_only=True)])
```

```bash CLI theme={null}
kiln sandbox create --drive <drive-id>:ro
```

Repeat this against **as many sandboxes as you want** — every one succeeds, concurrently, as long as every existing holder and every new attach are all `read_only: true`. A single **read-write attach** — existing or newly requested — still needs exclusive access; see [Drives](/concepts/drives) for the exact rule.

## Check who's holding it

```bash curl theme={null}
curl http://127.0.0.1:7777/drives
```

```ts list-drives.ts theme={null}
const drives = await Drive.list();
```

```python list_drives.py theme={null}
drives = Drive.list()
```

```bash CLI theme={null}
kiln drive ls
```

`attached_to` lists **every current holder** (`sandbox <id>` or `snapshot <id>`) with its `read_only` flag — useful for confirming a conflict's actual cause, or checking a drive is free before deleting it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.