> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/storage/block-storage/how-tos/detach-a-volume-from-a-virtual-machine.md).

# Detach a volume from a virtual machine

Before detaching a volume from a virtual machine, make sure to unmount it from the operating system first.

***

Before detaching a volume from a virtual machine, it's always safest to unmount the volume to avoid data loss. If you are running Linux, you should also remove any automounting of the volume that can prevent the system from booting without the volume. This is especially important if you are automounting the volume via `/etc/fstab` and not using the `nofail` option.

## Unmount the volume in the operating system

Start by looking up the WWN of the volume you want to detach. You can find the WWN for attached block storage volumes on the Block storage overview page, on each volume's overview, and on the Block storage tab on the VM overview.

Navigate to **Storage → Block storage**. Here you'll see the WWN of all attached volumes.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FwgDwHdvq4tLnSILbjMEK%2Fblock-storage-find-wwn2.png?alt=media&amp;token=e99feabb-b5ed-4d97-87aa-72c44736168d" alt=""><figcaption></figcaption></figure>

If you click on one of the volumes, you'll also find the WWN on that volume's overview.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FIJAzOcdQ1CTwAY0WVN5Z%2Fblock-storage-find-wwn1.png?alt=media&amp;token=3a47f7b1-7c1d-4272-aec3-a225fb2e7db3" alt=""><figcaption></figcaption></figure>

If you prefer to look at the VM's overview, you can find the WWN under the **Block storage** tab.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FrJ7JPBgdhGQov6wbSdZx%2Fkvm-vm-block-storage-wwn.png?alt=media&amp;token=4c7526ce-2925-41ae-be9d-d12d0dc2b6b1" alt=""><figcaption></figcaption></figure>

### Performing the unmount

Once you have found the WWN and noted it down, it's time to unmount it from the operating system.

{% tabs %}
{% tab title="Linux" %}
List all the current drives and volumes using `lsblk` to identify the volume by its WWN.

<pre data-title="Command and output. Command is highlighted."><code><strong>lsblk -o NAME,FSTYPE,WWN,MOUNTPOINTS
</strong>NAME    FSTYPE  WWN                MOUNTPOINTS
sda             0x305b0264d59532e7
├─sda1  ext4    0x305b0264d59532e7 /
├─sda14         0x305b0264d59532e7
└─sda15 vfat    0x305b0264d59532e7 /boot/efi
sdb             0x3fa0d41402141ef7
└─sdb1  ext4    0x3fa0d41402141ef7 /mnt/volume1
sr0
sr1     iso9660
</code></pre>

In this example, the mount point `/mnt/volume1` is using the volume with the matching WWN.

Start by unmounting the volume.

<pre data-title="Command"><code><strong>sudo umount /mnt/volume1
</strong></code></pre>

Then, disable automatic mounting of the volume by commenting out (with a `#`) or deleting the corresponding line in `/etc/fstab`. In our example, the line to delete will look like this.

{% code title="Line to comment out or delete in /etc/fstab" %}

```
/dev/disk/by-id/wwn-0x3fa0d41402141ef7-part1 /mnt/volume1 ext4 defaults,nofail 0 0
```

{% endcode %}
{% endtab %}

{% tab title="Windows Server (GUI)" %}
Start a PowerShell terminal and run the following command (search for ***Terminal*** or ***PowerShell*** in the Start menu).&#x20;

Execute `Get-Disk` and look for the WWN shown in the control panel and match it to a disk.

<pre data-title="Command and output. Command is highlighted."><code><strong>Get-Disk | Select-Object Number, FriendlyName, UniqueId
</strong>
Number FriendlyName       UniqueId
------ ------------       --------
     0 GLESYS LOCAL DISK  34CE12CC9399D6F5
     1 GLESYS REMOTE DISK 3DD0446B90C484F1
</code></pre>

In this example, disk number 1 matches the WWN from the control panel.

Open **Computer Management** by searching for it in the Start menu.

Once inside Computer Management, select **Disk Management** under **Storage**. Right-click on the disk number that corresponds to the WWN from the previous step (in this case, **Disk 1**). Select **Offline**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2Fu8GDGEBrK87UNynwFdPj%2Fwindows-server-2025-take-disk-offline.png?alt=media&amp;token=30788d02-56f2-4848-930a-f7585ef391ab" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Windows Server (PowerShell)" %}
Start a PowerShell terminal and run the following commands (search for ***Terminal*** or ***PowerShell*** in the Start menu).

Execute `Get-Disk` and look for the WWN shown in the control panel and match it to a disk.

<pre data-title="Command and output. Command is highlighted."><code><strong>Get-Disk | Select-Object Number, FriendlyName, UniqueId
</strong>
Number FriendlyName       UniqueId
------ ------------       --------
     0 GLESYS LOCAL DISK  34CE12CC9399D6F5
     1 GLESYS REMOTE DISK 3DD0446B90C484F1
</code></pre>

In this example, disk number 1 matches the WWN from the control panel.

Use `Set-Disk` to take the volume offline. Use the disk number from the above step.

<pre data-title="Command"><code><strong>Set-Disk -Number 1 -IsOffline $true
</strong></code></pre>

{% endtab %}
{% endtabs %}

## Detach the volume from the VM using the control panel

You can detach the volume from two places in the control panel: from the VM's Block storage tab, and from the block storage volume's overview. Choose the most convenient option for you.

{% tabs %}
{% tab title="From the VM's Block storage tab" %}
In the control panel, navigate to **Compute → Virtual machines**. Click on the VM. Then, click on the **Block storage** tab. Click the three dots next to the volume. Click **Detach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FSsTg072SJsEE5aIXOEwA%2Fblock-storage-detach1.png?alt=media&amp;token=a0822d27-2c65-4e4a-a4b5-49ecb3d88563" alt=""><figcaption></figcaption></figure>

In the dialog that opens, click **Detach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FPcmkjEYaOr1BzybuRgnE%2Fblock-storage-detach2.png?alt=media&amp;token=a59b1f7b-93d4-4eab-8c6c-5bb338b2868a" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="From the volume's overview page" %}
In the control panel, navigate to **Storage → Block storage**. Click on the volume. Click **Detach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2F1GAfURjn4PgzBwyquc3Q%2Fblock-storage-detach3.png?alt=media&amp;token=9839e777-f853-4982-837c-aa283cd962ed" alt=""><figcaption></figcaption></figure>

In the dialog that opens, click **Detach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FPcmkjEYaOr1BzybuRgnE%2Fblock-storage-detach2.png?alt=media&amp;token=a59b1f7b-93d4-4eab-8c6c-5bb338b2868a" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Detach the volume from the VM using the API

Use the [blockstorage/detach](https://github.com/GleSYS/API-docs/wiki/API-Documentation#blockstoragedetach) endpoint to detach the volume using the [API](https://docs.glesys.com/platform/control-panel/api.md).
