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

# Fork

> Copy a running machine, memory and disk included, in milliseconds.

A fork is a copy of a machine, the source machine. The copy includes the disk, **the memory, and every running process**, and carries on with its own name, URL, and ports from that point onwards. Unlike a [snapshot](/guides/snapshots), a fork does not save the state under a name. It shares the source machine's disk and memory through copy-on-write, so the new machine is up in under 200ms.

One example is [reproducible RL environments](/use-cases/reproducible-rl-environments).

<Frame caption="One command, and the copy is up in milliseconds.">
  <video autoPlay muted loop playsInline src="https://mintcdn.com/azin/AlEw94GJXGsEfPlY/videos/boxd-m-fork.mp4?fit=max&auto=format&n=AlEw94GJXGsEfPlY&q=85&s=4afc4077fe11c6859c9b59b50861cd8d" data-path="videos/boxd-m-fork.mp4" />
</Frame>

## Fork a machine

```bash theme={"theme":"github-dark"}
boxd machine fork myapp
```

```text theme={"theme":"github-dark"}
  source: fork/myapp
    boot: 160ms

Connect:
  ssh       ssh myapp-fork.boxd
  cli       boxd machine connect myapp-fork
  browser   https://myapp-fork.boxd.sh
```

Without a name, the fork is called `myapp-fork`, and that name has to be free. Forking twice without naming the second one fails with `name 'myapp-fork' is already taken`.

With `--json`:

```json theme={"theme":"github-dark"}
{
  "name": "myapp-fork",
  "id": "63b8339c-411a-4c29-a0ff-09dd3da35c57",
  "url": "myapp-fork.boxd.sh",
  "source": "fork/myapp",
  "boot": "161ms"
}
```

## Running processes come with it

This is what separates a fork from a fresh machine. A server listening on the source machine is already listening on the fork, at the fork's own URL, without anything starting up.

The processes are the same processes on a different machine. Fork a machine running a web server and you will find it under the same PID, with the same start time, and the machine's uptime carries on from the source machine rather than resetting to zero.

So a fork skips whatever the source machine already did. Dependencies are already installed, a database is warm, and a dev server has finished compiling. There is nothing to rerun.

You can fork a machine in any state, and what carries over follows from what the source machine has to give. A running source machine pauses for a fraction of a second to hand its live memory to the copy, then carries on. A hibernated source machine stays hibernated while the copy wakes from its memory image. A stopped source machine stays stopped and the copy boots fresh from the disk, since a stopped machine has only its disk left to copy. The fork itself always comes up running.

## After the fork

The two machines are independent from the moment of the fork. Writes on one do not reach the other. The fork gets its own 100 GB disk, copy-on-write against the source machine, so it uses close to no extra storage until it starts to differ. A fork keeps the source machine's size. If the source machine has an [egress allowlist](/guides/egress), the fork starts with the same one.

## What to use it for

* **Try something risky.** Fork, break the fork, delete it. The source machine is untouched.
* **Run several attempts at once.** Fork three times from the same state and compare the results.
* **Reproduce a bug.** Fork the machine that is misbehaving and dig around in the copy.
* **Hand someone a copy.** Give a reviewer or an agent its own machine that already runs your app.

For a copy you want to keep and create machines from later, use a [snapshot](/guides/snapshots) instead. To rewind one machine rather than copy it, use a [checkpoint](/guides/checkpoints).

## Forking a shared machine

If you fork a machine [shared with your organization](/guides/share-a-vm), the fork is **private to you** by default. The org keeps paying, only you can reach the copy, and your Claude Code and Codex logins for that org are served to it right away. OpenCode needs a login on the fork, since it has one login per machine.

```bash theme={"theme":"github-dark"}
boxd machine fork staging            # private to you, org-billed, agent logins served
boxd machine fork staging --shared   # keep the fork visible to the whole org
```

Forking a private machine works the same way, and the fork stays private.


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