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

# Reconnecting a VM to Cloud Backup

{% note info %}

If you have [deleted](delete-vm.md) a VM from Cloud Backup and want to reconnect it, use these tutorials:

* [Connecting a Linux VM](connect-vm-linux.md)
* [Connecting a Linux VM with OS Login](connect-vm-oslogin-linux.md)
* [Connecting a Windows VM](connect-vm-windows.md)

{% endnote %}

{% note warning %}

When reconnecting, the VM is added to Cloud Backup as a new resource. Backups of the new VM are stored as per the linked [backup policy](../concepts/policy.md#retention).

The backup policy rules do not apply to the old VM's backups. Their storage is subject to the [pricing policy](../pricing.md#backups). If you do not need those backups, [delete](backup-vm/delete.md) them manually or use [bulk delete](backup-vm/batch-delete.md).

{% endnote %}

After you [restore one VM from a backup of another one](backup-vm/non-native-recovery.md), the source VM the backup was created from becomes outdated. To avoid conflicts between the two VMs during backup, reconnect the outdated VM to Cloud Backup.

Reconnecting can also help when the [Cloud Backup agent](../concepts/agent.md) stops working and goes offline.

To reconnect a VM to Cloud Backup:

1. Reconnect to Cloud Backup from the outdated VM:

    {% list tabs group=operating_system %}

    - Linux {#linux}

      1. [Connect](../../compute/operations/vm-connect/ssh.md#vm-connect) to the VM over SSH.
      1. Install the [jq](https://jqlang.github.io/jq/), [awk](http://awklang.org/), [curl](https://curl.se/), and [uuidgen](https://uuidgen.org/) utilities on the VM:

          {% note info %}

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

          {% endnote %}

          ```bash
          sudo apt install jq -y
          sudo apt install gawk -y
          sudo apt install curl -y
          sudo apt install uuid-dev -y
          ```

          For some distributions, you may also need to install the `uuid-runtime` package:

          ```bash
          sudo apt install uuid-runtime -y
          ```

      1. Run this command:

          ```bash
          curl 'https://storage.yandexcloud.net/backup-distributions/agent_reinit.sh' | sudo bash
          ```

          Result:

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

    - Windows {#windows}

      1. [Connect](../../compute/operations/vm-connect/rdp.md) to the VM over RDP.
      1. Run Windows PowerShell.

          {% note info %}
          
          The PowerShell execution policies must allow scripts. If not, allow scripts and restart PowerShell. For more information, see [this Microsoft guide](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies).
              
          {% endnote %}

      1. Run this command:

          ```powershell
          . { iwr -useb https://storage.yandexcloud.net/backup-distributions/agent_reinit.ps1 } | iex
          ```

          Result:

          ```text
          ...
          Backup agent reinit completed after 204 s!
          ```

    {% endlist %}

1. Disconnect from the VM.
1. Make sure the outdated VM is no longer on the list of VMs connected to Cloud Backup:

    {% list tabs group=instructions %}

    - Management console {#console}

      1. In the [management console](https://console.yandex.cloud), select the folder where Cloud Backup is connected.
      1. Navigate to **Cloud Backup**.
      1. On ![machines](../../_assets/console-icons/server.svg) **Virtual machines** tab, check that the outdated VM is not listed with the ![irrelevant](../../_assets/console-icons/circle-info-fill.svg) label.

          If the VM is still there, click ![image](../../_assets/console-icons/ellipsis.svg), select **Delete** and confirm deletion.

    {% endlist %}

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