---
title: "Disconnect a network volume from a dedicated server"
sidebar_label: "Disconnect a network volume from a server"
description: "How to disconnect a network volume from a server"
sidebar_position: 8
toc_max_heading_level: 2
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { TabItemLabel } from '@selectel/docux/components';
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical';
import ServersOffIcon from '@selectel/docux/icons/servers-off';

# Disconnect a network volume from a dedicated server

:::warning

If you disconnect a network volume from a server that is part of a group, the volume will be disconnected from all servers in the group. A network volume cannot be used with a server if they are not connected in the control panel.

:::

1. If the network volume was not connected to the server in the server OS, proceed to step 2. If the network volume was connected to the server in the server OS, [disconnect the network volume from the server in the server OS](#disconnect-block-storage-from-server-in-os).
2. [Disconnect the network volume from the server in the control panel](#disconnect-block-storage-from-server-in-panel).

## 1. Disconnect the network volume from the server in the server OS \{#disconnect-block-storage-from-server-in-os}

<Tabs queryString="disconnect-block-storage-from-server-in-os">
  <TabItem value="linux" default>
    <TabItemLabel>
      Linux
    </TabItemLabel>

    1. [Connect to the server via SSH](/dedicated/manage/connect-to-server.mdx#connect-via-ssh) or using the [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console).

    2. Output information about the network volumes:

       ```bash
       multipath -ll
       ```

       Information about the volumes will appear in the response. Remember or copy the network volume name.

    3. Unmount the network volume:

       ```bash
       umount /mnt/<block_storage_name>
       ```

       Specify `<block_storage_name>` — the network volume name you copied in step 2, for example `mpatha`.

    4. Disable automatic connection to the iSCSI target:

       ```bash
       iscsiadm -m node --op update -n node.startup -v manual
       ```

    5. Terminate all active iSCSI sessions:

       ```bash
       iscsiadm -m node --logoutall=all
       ```

    6. Ensure there are no active iSCSI sessions:

       ```bash
       iscsiadm -m session
       ```

    7. Output information about iSCSI interfaces:

       ```bash
       iscsiadm -m iface
       ```

    8. Delete the iSCSI interfaces you created when connecting the network volume to the server:

       ```bash
       iscsiadm -m iface -I <iscsi_eth_name_1> --op delete
       iscsiadm -m iface -I <iscsi_eth_name_2> --op delete
       ```

       Specify:

       * `<iscsi_eth_name_1>` — the name of the first iSCSI interface you obtained in step 7;
       * `<iscsi_eth_name_2>` — the name of the second iSCSI interface you obtained in step 7.

    9. If you [configured MultiPath-IO](/block-storage/manage/connect-block-storage-to-linux.mdx#configure-mpio) when connecting the disk, disable it:

       ```bash
       multipath -F
       systemctl stop multipathd
       systemctl disable multipathd
       ```

    10. Open the `netplan` utility configuration file with the `vi`` editor`:

        ```bash
        vi /etc/netplan/50-cloud-init.yaml
        ```

    11. Remove from the `netplan` utility file the static routes you added when [connecting the disk to the server](/block-storage/manage/connect-block-storage-to-linux.mdx#connect-block-storage-to-server-in-os) in step 3.

    12. Exit the `vi` text editor saving your changes:

        ```bash
        :wq
        ```

    13. Apply the configuration:

        ```bash
        netplan apply
        ```
  </TabItem>

  <TabItem value="windows" default>
    <TabItemLabel>
      Windows
    </TabItemLabel>

    1. [Connect to the server via RDP](/dedicated/manage/connect-to-server.mdx#connect-via-rdp) or the [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console).

    2. Run PowerShell as an administrator.

    3. Output information about the disks in the system:

       ```bash
       Get-Disk
       ```

       Information about the volumes will appear in the response. Remember or copy the network volume number.

    4. Set the network volume to the `Offline`` state`:

       ```bash
       Set-Disk -Number <disk_number> -IsOffline $true
       ```

       Specify `<disk_number>` — the disk number you copied in step 3.

    5. Check active iSCSI connections:

       ```bash
       Get-IscsiSession
       Get-IscsiTarget
       ```

    6. Disable automatic connection to the iSCSI target:

       ```bash
       Set-IscsiTarget -NodeAddress <iqn> -IsPersistent $false
       ```

       Specify `<iqn>` — the IQN of the iSCSI target. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **iSCSI connection configuration** → field **Target name**.

    7. Terminate the connection to the iSCSI target:

       ```bash
       Disconnect-IscsiTarget -NodeAddress <iqn> -Confirm:$false
       ```

       Specify `<iqn>` — the IQN of the iSCSI target. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **iSCSI connection configuration** → field **Target name**.

    8. Delete iSCSI target portals:

       ```bash
       Remove-IscsiTargetPortal -TargetPortalAddress <iscsi_target_ip_address_1>
       Remove-IscsiTargetPortal -TargetPortalAddress <iscsi_target_ip_address_2>
       ```

       Specify:

       * `<iscsi_target_ip_address_1>` — IP address of the first iSCSI target. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **iSCSI connection configuration** → field **IP address of the iSCSI target 1**;
       * `<iscsi_target_ip_address_2>` — IP address of the second iSCSI target. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **iSCSI connection configuration** → field **IP address of the iSCSI target 2**.

    9. Remove the static routes used to connect the network volume:

       ```bash
       Remove-NetRoute -DestinationPrefix <destination_subnet_1> -NextHop <next_hop_1>
       Remove-NetRoute -DestinationPrefix <destination_subnet_2> -NextHop <next_hop_2>
       ```

       Specify:

       * `<destination_subnet_1>` — destination subnet for the first network card port. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **Static routes for connecting to iSCSI targets** → column **Destination Subnet**;
       * `<next_hop_1>` — the gateway for the first network card port.<br />You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → **Network Volumes and Storage** section → **Network Volumes** tab → disk page → **Network interface configuration** block → **Next hop (gateway)**;
       * `<destination_subnet_2>` — destination subnet for the second network card port. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **Static routes for connecting to iSCSI targets** → column **Destination Subnet**;
       * `<next_hop_2>` — gateway for the second network card port. You can view it in the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks): in the top menu, click **Products** → **Dedicated Servers** → section **Network Volumes and Storage** → tab **Network Volumes** → disk page → block **Network interface configuration** → column **Next hop (gateway)**.

    10. Restart the Microsoft iSCSI Initiator service to clear the cache:

        ```bash
        Set-Service -Name MSiSCSI -StartupType Disabled
        Restart-Service MSiSCSI
        ```
  </TabItem>
</Tabs>

## 2. Disconnect the network volume from the server in the control panel \{#disconnect-block-storage-from-server-in-panel}

1. In the [control panel](https://my.selectel.ru/servers/shd/block-storage/disks), in the top menu, click **Products** and select **Dedicated Servers**.
2. Go to the **Network Volumes and Storage** section → **Network Volumes** tab.
3. Open the disk page.
4. Click <ServersOffIcon />.
5. Confirm the disconnection by entering the disk name.
6. Click **Detach**.

<Formbricks />
