# Avoid a machine

Each server runs on one machine of one hosting provider. Now and then a machine is worse than its listing: a slow disk, a network that drops, a GPU that keeps failing. You can mark that machine so none of your team's later launches is placed on it again.

## When to use it

- A server on the machine was clearly slower than others of the same plan, or kept losing its connection.
- Launches or workers keep failing on the same machine.
- You want a fresh machine for the next try after a problem you could not explain.

For a one-off problem, a restart or a new server is usually enough (see [Server problems](/docs/server-problems)). Marking a machine is for one you never want again.

## What it does and does not do

- Every later launch of your organization skips the machine: new servers, copies, **Launch again**, recreated servers, serverless workers and server-group servers. New volumes are not placed on it either.
- The launch takes the next machine that fits, at the price it would have had anyway. Prices do not change.
- The server you marked it from is **not** changed: it keeps running, or stays stopped, as it is now. To move it, destroy it and launch a new one, or recreate it (which erases its disk).
- It applies to your organization only. Other customers can still use the machine.
- The machine itself is never named, not even to you: each entry is named by the server you marked it from.
- If few machines offer a GPU, avoiding some of them can leave none in stock for that plan. Remove an entry to use the machine again.

**Volumes:** a server can only use a volume that lives on its own machine. So marking a machine is refused while one of your volumes lives on it. Delete or empty the volume first, or keep the machine.

## Mark a machine in the console

1. Open **Servers** and select the server that ran on the machine.
2. Go to the **Settings** tab and find **Don't use this machine again**.
3. Select **Avoid this machine**, add a reason if you like (for example "slow disk", up to 200 characters) and select **Don't use this machine**.

It works for a running or stopped server, and from the CLI or the API also for one you already destroyed, as long as it once got a machine. This needs a role that may manage servers.

## The list of machines you avoid

Go to **Settings**, **Organization**, **Machines you avoid**. Each entry shows the server it was marked from, the reason, who marked it and when. Select **Remove** to let later launches use that machine again. Nothing else changes.

Your organization can keep up to **100** entries. At the limit, remove an old entry before you add one.

## From the CLI and the API

```bash
apidly avoided-machines add ins_example --reason "slow disk"
apidly avoided-machines
apidly avoided-machines rm avh_example
```

`add` answers `Avoided: no later launch of your organization is placed on the machine of ins_example ...` or, when it is already on the list, `The machine of ins_example is already avoided`. `rm` asks first unless you pass `--yes`.

The API: `POST /api/v1/servers/{id}/avoid-machine` with an optional `{"reason": "..."}`, `GET /api/v1/avoided-machines` and `DELETE /api/v1/avoided-machines/{id}`. Errors: `409 volume_on_machine` (one of your volumes lives there), `409 limit_reached` (100 entries), `409 invalid_state` (the server never got a machine). Details are in [API reference: Servers, requests and groups](/docs/api-servers#post-serversidavoid-machine).

## Next

- [Server problems](/docs/server-problems)
- [If a server fails to start](/docs/if-a-server-fails-to-start)
- [Volumes and copies](/docs/storage)
