[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Backup](../../index.md) > [Step-by-step guides](../index.md) > BareMetal in Cloud Backup > Reconnecting a BareMetal server to Cloud Backup

# Reconnecting a Yandex BareMetal server to Cloud Backup


If you deploy a backup of one server to another, the original server's connection to Cloud Backup becomes outdated. To continue backing up the original server and avoid conflicts with the new one, upgrade the source server connection to Cloud Backup:

1. To connect a BareMetal server to Cloud Backup, you need a [service account](../../../iam/concepts/users/service-accounts.md) with at least the `backup.user` and `baremetal.editor` [roles](../../../iam/concepts/access-control/roles.md). [Create](backup-baremetal.md#prepare-service-account) one or assign the required roles to an existing service account.
1. Get an [IAM token](../../../iam/operations/index.md#authentication).
1. Reconnect to Cloud Backup from the outdated server:

    {% list tabs group=operating_system %}

    - Linux {#linux}

      1. [Connect](../../../compute/operations/vm-connect/ssh.md#vm-connect) to the server over SSH.
      1. On your server, install [curl](https://curl.se/), [wget](https://www.gnu.org/software/wget/), [gawk](https://www.gnu.org/software/gawk/), [uuid-dev](https://en.wikipedia.org/wiki/UUID), and [uuidgen](https://uuidgen.org/).

          {% note info %}

          If you are using a distribution other than Ubuntu, install the specified tools using your package manager.

          {% endnote %}

          ```bash
          sudo apt install curl
          sudo apt install wget
          sudo apt install gawk
          sudo apt install uuid-dev
          sudo apt install uuid-runtime
          ```

      1. Update your connection to Cloud Backup:

          ```bash
          wget https://storage.yandexcloud.net/backup-distributions/agent_reinit_bms.sh
          sudo bash agent_reinit_bms.sh -t=<IAM_token>
          ```

          Where `-t` is the IAM token you got earlier.

          Result:

          ```text
          ...
          Deleting old resource bound for instance_id epdoe4g6dbq4******** and resource_id: F07543A1-BDC1-415A-A143-C18E********
          Updating ids in Cloud Backup
          Finished
          ```

    {% endlist %}

1. Make sure the server is connected to Cloud Backup:

    {% list tabs group=instructions %}

    - CLI {#cli}

      If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

      The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

      Get a list of BareMetal servers connected to Cloud Backup:

      ```bash
      yc backup resource list --type bms
      ```

      Where `--type` is the resource type.

      Result:

      ```text
      compute_instance_id: epd5sk4auijm********
      created_at: "2024-11-17T10:29:40.436155166Z"
      updated_at: "2024-11-17T10:32:54.580592713Z"
      online: true
      enabled: true
      status: IDLE
      next_backup_time: "2024-11-24T00:00:00Z"
      resource_id: ad216376-a8d7-4c28-9a8d-b4ad********
      is_active: true
      init_status: REGISTRED
      metadata: "null"
      type: BMS
      ```

    {% endlist %}

1. [Link](../policy-vm/attach-and-detach-vm.md) the server to a backup policy.