---
title: "Drive quickstart"
description: "Make a Drive, write to it from one sandbox, and read it from the next, with the glac command line, the Python SDK or the console."
---

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

# Drive quickstart

You need a project's API key in `GLAC_API_KEY`, and `glac` or the Python SDK installed: [get started](/docs/quickstart/) says how.

## With the command line

Make a Drive of at most 1 GiB (one may be up to 10 GiB on Free, 1 TiB on a paid plan), and a sandbox that mounts it at `/data`. `--region na|eu|ap` would say where it is; without it, it is in the region of the API you call:

```bash
glac drives create --name data --size-bytes 1GiB
glac sandboxes create --name first --drive data:/data
glac sandboxes exec first -- sh -c 'echo kept > /data/note'
```

Take it from that sandbox and give it to another one that runs:

```bash
glac drives detach data first
glac sandboxes create --name second
glac drives attach data second:/data
glac sandboxes exec second -- cat /data/note      # kept
```

Look at it, and clean up:

```bash
glac drives ls                                    # each Drive: its size, what is written, its region, who has it
glac drives get data                              # and the machine that writes it now
glac sandboxes rm first second                    # the Drive stays
glac drives rm data
```

A Drive is one sandbox's at a time: attaching one that another sandbox has is refused (409 `drive_attached`). Deleting a sandbox detaches its Drives, which keep what they hold. A Drive that is mounted is not deleted.

## With the Python SDK

```python
from glac import DriveMount, Glac

glac = Glac()  # GLAC_API_KEY and GLAC_API_URL
drive = glac.drives.create(name="data", size_bytes=1 << 30)   # region="eu" to choose where

first = glac.sandboxes.create(drives=[DriveMount("/data", drive)])
first.run("echo kept > /data/note")
glac.drives.detach(first, drive)

second = glac.sandboxes.create()
glac.drives.attach(second, drive, "/data")
print(second.run("cat /data/note").stdout)      # kept
print(glac.drives.get("data").used_bytes)       # what it is billed by

first.delete()
second.delete()                                 # detaches it
drive.delete()
```

A Drive that another machine held last is brought to the sandbox's machine first. While that cannot be done yet, the call answers 503 `copy_behind` or `drive_not_brought`, which are `retryable`: the SDK tries again as its `retries` say, and then raises, for you to ask again a moment later.

## In the console

Open the [console](https://console.glac.ai/console/), pick the project, and choose **Drives** under Storage. The page lists the project's Drives: name, kind (a Drive, or a key's Drive), size, what is written, the sandbox that has it, region, status and when it was made. Make, mount and delete Drives with the command line or the API.

## Next

- [How Drives work](/docs/drive/concepts/): Cubes with a Drive, one writer, regions, billing.
- [Snapshots and forks](/docs/drive/snapshots/): keep a Drive as it is, restore it, fork it, mount it read-only.
- [Shared volumes and backups](/docs/drive/volumes/)

Source: https://glac.ai/docs/drive/quickstart/index.mdx
