> For the complete documentation index, see [llms.txt](https://docs.i3d.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.i3d.net/compute/flexmetal/reinstall-your-servers.md).

# Reinstall your servers

{% hint style="danger" %}
Warning: By default, the operation will cause a **full disk wipe** and all data will be lost! You can opt out by appending `?wipeDisk=false` to the request URL. Proceed with caution.
{% endhint %}

To reinstall your servers, use the endpoint provided in the [API documentation](https://docs.i3d.net/api/api_flexmetal#patch-v3-flexmetal-servers-uuid). Ensure you obtain the required UUID from the POST /servers response body. You may pass optional parameters such as:

* `name` (hostname)
* `os` (operating system), which must include a slug property
* `kernelParam` (optional)
* `partitions` (optional)
* `sshKey` (optional). If you leave it out, the keys from the original server request are reinstalled. See [SSH keys on reinstall](#ssh-keys-on-reinstall) below.
* `postInstallScript` (a shell script on Linux, PowerShell on Windows — see [Post-install scripts](/compute/flexmetal/post-install-scripts.md)). If omitted, no script runs; the one from the original server request is not carried over.

### Usage Scenarios

{% tabs %}
{% tab title="Reinstall with the Initially Requested OS" %}

* **Parameters:**
  * `name`: (string)\
    Optionally include `kernelParam`, `partitions`, `sshKey`
* **Behavior:**\
  The originally provisioned OS will be reinstalled, including any specified `kernelParam`, custom `partitions`, and/or `sshKey`.
  * If you pass a new `sshKey`, it replaces the original. If you leave it out, the original keys are reinstalled.
    {% endtab %}

{% tab title="Reinstall with a Different OS" %}

* **Parameters:**
  * `os`: (object)\
    Fully specify the OS you want to install.
* **Behavior:**\
  The originally provisioned OS will be replaced by the provided OS object, which is installed instead.
  {% endtab %}

{% tab title="Reinstall with Specific SSH Keys" %}

* **Parameters:**
  * `sshKey`: (array)
* **Behavior:**\
  The originally provisioned OS is reinstalled, but **only** the passed SSH keys are injected (not the default/original ones).
  {% endtab %}

{% tab title="Reinstall Without Wiping the Disk" %}

* **Query parameter:** `?wipeDisk=false`
* **Behavior:**\
  The OS is reinstalled, but the explicit quick-format pre-step is skipped.
  {% endtab %}
  {% endtabs %}

### SSH keys on reinstall

`sshKey` is optional on a reinstall, whichever operating system you install — including when you switch to a different OS.

What you send decides which keys end up on the reinstalled server:

| You send                            | Result                                                                  |
| ----------------------------------- | ----------------------------------------------------------------------- |
| Nothing, or `"sshKey": null`        | The keys from the original server request are reinstalled               |
| `"sshKey": []`                      | Also the original keys — an empty array does **not** clear them         |
| `"sshKey": ["ssh-ed25519 AAAA..."]` | **Only** the keys you pass are installed; the original ones are dropped |

{% hint style="warning" %}
If the original request carried SSH keys, a reinstall cannot remove all of them. If you want a server without keys, release it and order a new one without `sshKey`.
{% endhint %}

**Example PATCH request with all of the options**

```json
{
  "name": "host.example.com",
  "os": {
    "slug": "ubuntu-2404-lts",
    "kernelParams": [
      {
        "key": "test-kernel-param-key",
        "value": "test-kernel-param-value"
      }
    ],
    "partitions": [
      {
        "target": "/custom",
        "filesystem": "ext4",
        "size": 10240
      }
    ]
  },
  "sshKey": [
    "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHo8IaPkQ6UnDZvi4F4RBSouRa6Gtysdg2EF+SIXheVF2SGBQ2uH7RfDjXRfvq4VpHJrKYs4kWfNoHQg8ZG6PH4= ecdsa-key-20240131"
  ],
  "postInstallScript": "#!/bin/bash\necho \"Hello world!\" > /root/test.txt"
}

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.i3d.net/compute/flexmetal/reinstall-your-servers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
