# Daily Operations

> The normal lifecycle for the one deployment: inspect, access, scale, change, stop, and destroy.

---

LLMS index: [llms.txt](/v1.5/llms.txt)

---

Once a lab is running, day-to-day work comes down to a few commands: check it, log in, stop it overnight, apply an inventory edit, and tear it down. This page covers them for the Linux lab; macOS VMs have their own [lifecycle](../macos/#everyday-lifecycle).

## Inspect and access {#inspect-and-access}

```bash
barn status
barn ssh meta
barn exec node-1 -- hostname
barn logs meta --source serial
```

These commands read the deployment stored in `BARN_HOME` (default `~/.barn`), so they work from any directory; if you set `BARN_HOME` yourself, use an absolute path. `barn status` shows each node's image and resources and flags software emulation (`tcg`); `barn status --verbose` adds guest architecture, accelerator, loopback SSH port, and QEMU PID.

Every `barn up`, including one for a subset of nodes, refreshes the `~/.ssh/barn_config` aliases for the whole deployment, so `ssh meta` keeps working. Run `barn ssh-config --install` to refresh them at any other time.

Commands that read an inventory (`plan`, `up`, `reload`, `resize`, `recreate`) use `-f`, else the first of `barn.yml`, `barn.yaml`, `pigsty.yml`, `pigsty.yaml` in the current directory, else the applied specification ([Discovery](../../reference/configuration/#discovery)). Pass `-f pigsty.yml` when a directory has both `barn.yml` and `pigsty.yml`.

Running `barn up` again on a healthy lab is safe: it retries unfinished guest setup and updates guest helper scripts without restarting running VMs. Anything it could not set up is listed under `nodes[].warnings`, and anything it repaired, such as a [reset data disk](../storage/#when-barn-resets-a-data-disk), under `nodes[].repairs`.

## Stop and start {#stop-and-start}

```bash
barn stop
barn start
barn restart node-1
barn reload -f barn.yml
```

| Command | Reads the inventory | What it does |
|---|---|---|
| `stop` | No | Stops running nodes |
| `start` | No | Boots stopped nodes, re-checks running ones, and updates SSH aliases if a loopback port had to move |
| `restart` | No | Stops and boots nodes with their applied definitions |
| `reload` | Yes | Validates the inventory, stops the selected nodes, then runs `up`; can add new nodes |
{.wide .expand}

Before stopping anything, `reload` refuses changes to an existing node's definition (CPU, memory, image, disks, shares, addresses); apply those with `resize` or `recreate`.

`--no-wait` returns as soon as QEMU starts and skips readiness checks, guest recovery, the startup clock check, and `/etc/hosts` and control-node SSH updates until the next `barn up`.

Startup corrects guest clocks that drifted while the host slept. For a lab that keeps running, use `barn time status`, `barn time sync`, or the opt-in timer `barn time auto enable` ([time reference](../../reference/commands/time/)).

## Change the deployment {#change-the-deployment}

Editing the inventory never changes a VM on its own. `barn plan` shows what the edit means, and you apply it with the command the plan names:

```bash
barn plan
barn up                         # create or start nodes and refresh SSH aliases
barn resize node-1              # apply vm_cpu/vm_mem changes in place
barn recreate node-1            # rebuild a node whose definition changed
```

| Plan reports | Meaning | Apply with |
|---|---|---|
| `create` | Node is in the inventory but not provisioned yet | `barn up` |
| `resize` | Node CPU or memory changed | `barn resize <node>` |
| `recreate` | Node image, disks, shares, or other VM definition changed | `barn recreate <node>` |
| `missing` | Provisioned node is no longer in the inventory | Restore the YAML entry, or `barn destroy <node>` |
{.wide .expand}

With `--json`, `start`, `create`, `resize`, `recreate`, and `missing` are node lists, and `action` summarizes the plan as `create`, `start`, `converge`, `resize`, `recreate`, `blocked-removal`, `repair`, or `none`. `blocked`, when present, is a string explaining what blocks the plan, and `whole_deployment: true` means every node has to be recreated together; run the command the plan suggests so new nodes are included. Pigsty service variables that Barn does not read produce `action: none`. The full schema is in [Planning](../../reference/cli/#planning).

### Resize CPU, memory, or the root disk {#resize}

Edit `vm_cpu` or `vm_mem` and run `barn resize`. Increases are hot-plugged where the backend supports it; decreases and other backends stop and start the VM, keeping its identity and disks. `barn resize -D` grows the root disk in place ([root growth](../../reference/cli/#root-disk-growth)).

If an online resize is interrupted after hot-plugging, `barn status` reports `reason: resize_incomplete`. Run `barn resize NODE` again to finish, or `barn restart NODE` to return to the committed resources.

### Recreate a node {#recreate}

`recreate` is the explicit way to replace a VM. Barn first validates the new image, network, shares, and persistent-disk layout, then destroys the selected VMs and boots fresh ones from the inventory. Root disks and non-persistent data disks are replaced, compatible persistent disks are reattached ([what survives](../storage/#what-survives-each-operation)), and each new VM gets a new identity and refreshed SSH host-key state.

On a terminal, `recreate` and `destroy` list the affected nodes and ask you to type the command name; scripts pass `--yes` (or `--force`).

Without node names, `recreate` replaces every node. If the inventory no longer lists an existing node, it stops before touching any VM (exit `4`, `reason: nodes_removed`): run `barn destroy <node>` or add the node back.

### Apply changes to selected nodes {#selected-nodes}

You can edit several nodes and roll the changes out one at a time:

```bash
barn plan node-1 -f barn.yml
barn recreate node-1 -f barn.yml
barn plan node-2 -f barn.yml
```

With explicit node names, `plan`, `up`, `reload`, `recreate`, and `resize` keep every unselected node's applied definition, even if its YAML entry was edited or removed, and do not resolve images for unselected nodes that do not exist yet. The whole inventory must still parse, and the selected changes must not conflict with applied addresses, aliases, control-node roles, or deployment-wide settings.

Without node names, Barn evaluates the whole inventory: CPU and memory changes need `resize`, other changes to existing VMs need `recreate`, and missing nodes need their entry restored or an explicit `destroy`.

## Concurrent commands {#concurrent-commands}

Within one command, `--parallel/-p` sets how many nodes are handled at once (default `max(1, logical CPUs - 2)`; see [lifecycle concurrency](../../reference/cli/#lifecycle-concurrency)).

Commands that change the deployment (`up`, `start`, `stop`, `restart`, `reload`, `resize`, `recreate`, `destroy`, `purge`, `provision`) take a lock in `BARN_HOME`, so only one runs at a time. Another waits up to 10 minutes (or its shorter `provision --timeout`), showing the holder's command, PID, and start time, then exits `4` with `reason: deployment_busy`. The lock is released when its process exits; never delete lock files by hand.

Read-only and access commands (`status`, `ssh`, `exec`, `ssh-config`, `hosts`) don't wait. `barn status` shows the last committed state, with a `note` naming any operation in progress. For a command that was killed midway, see [Troubleshooting](../troubleshooting/#a-command-was-killed).

## Destroy {#destroy}

`barn purge` and `barn destroy --yes --purge` immediately power off running Linux VMs before deleting their disks. Run `barn stop` first to give databases and other guest services time to shut down.

Pick the scope to remove:

```bash {tab="Single node" group="destroy-scope" value="node"}
barn destroy node-3
```

```bash {tab="Keep persistent disks" group="destroy-scope" value="lab"}
barn destroy
```

```bash {tab="Delete persistent disks" group="destroy-scope" value="persistent"}
barn destroy --delete-persistent
```

```bash {tab="Purge lab & keys" group="destroy-scope" value="purge"}
barn purge
```

- `barn destroy <node>` removes one node and refreshes SSH aliases for the rest. If it removes the control node, the first remaining node takes over, so `ssh-config`, `hosts`, `exec`, and `provision` keep working. Set `admin_ip` in the inventory to the new control node (and delete the old entry unless you want `up` to recreate it), then run `barn up` to install its control SSH access.
- `barn destroy` removes every VM with its root disk and non-persistent data disks, plus the deployment state and Barn's SSH aliases. It keeps persistent disks, deployment keys, cached images, and the host network, so `barn up` rebuilds the lab from the inventory.
- `barn destroy --delete-persistent` also deletes persistent disks; `--purge` also deletes keys and deployment state. Both apply to the whole deployment only.
- `barn purge` deletes the whole lab, persistent disks, keys, and deployment state immediately, keeping the image cache and host network. `barn purge --ask` shows the nodes and scope first and accepts `y`/`yes`; `n`/`no`, an empty line, or EOF cancels. `purge` accepts no `--yes`, `-y`, or `--force`.

Each command's effect on data disks is summarized in [What survives each operation](../storage/#what-survives-each-operation). Once no Linux VM remains, you can remove the host network:

```bash
barn network uninstall --yes
```

To clear cached images, see [Image Repositories](../images/); to remove Barn completely, see [Uninstall](../uninstall/).
