> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ibee.co.in/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ibee.co.in/docs/_mcp/server.

# Attach and detach a volume

> Attach a Block Storage volume to an IBEE Solutions server, mount it inside the guest, and safely detach when you're done.

Attaching a volume connects it to a server so the OS sees it as a disk device (e.g. `/dev/vdc`). The portal handles the attach itself; you then format and mount the volume inside the guest using the commands on the **Mount Instructions** tab.

## Before you begin

* A **Ready** Block Storage volume ([Create a volume](/docs/infrastructure/block-storage/create-a-volume))
* A running IBEE Solutions server in the **same region** as the volume
* SSH access to that server (Remote Desktop or PowerShell access for Windows servers)

## Attach a volume

### Open the volume

In the portal, go to **Block Storage** and click the volume you want to attach.

### Click Attach to Server

On the **Overview** tab, scroll to the **Attached To** section. For an unattached volume you'll see **Not attached to any server** with an **Attach to Server** button.

Click **Attach to Server**.

### Pick a server

In the **Attach Volume** dialog:

* **Server** — select a running server in the same region as the volume. The dropdown shows each server's name and status (e.g. `test (running)`).

Click **Attach**. The button shows **Attaching…** while the platform connects the volume.

### Confirmation

A toast confirms **Volume `<label>` attached**. The volume status changes to **In Use**, and the **Attached To** section now shows the server's UUID, the device path (e.g. `Device: /dev/vdc`), and a **Detach** button.

## Mount the volume (Linux)

After attaching, open the **Mount Instructions** tab on the volume detail page. It shows a green confirmation panel:

> **Volume is attached — run these commands inside your server.**
> Device: `/dev/vdc` on server `<server_id>`

Copy the device path from the panel — that's the placeholder you replace below.

SSH into the server and run the **Mounting** commands:

```bash
# 1. Check the disk is visible
lsblk

# 2. Format (FIRST TIME ONLY — skip if volume already has data)
sudo mkfs.ext4 /dev/vdc

# 3. Create mount point
sudo mkdir -p /mnt/data

# 4. Mount
sudo mount /dev/vdc /mnt/data

# 5. Verify
df -h /mnt/data

# 6. Make persistent across reboots
UUID=$(sudo blkid -s UUID -o value /dev/vdc)
echo "UUID=$UUID /mnt/data ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
```

> **Warning**
>
> Step 2 (`mkfs.ext4`) **erases everything on the volume**. Only run it on a brand-new volume. Skip it for any volume that already has data.

If the device path on your **Mount Instructions** tab is something other than `/dev/vdc` (e.g. `/dev/vdb`), substitute it everywhere in the commands above.

## Mount the volume (Windows)

For a Windows server, the **Mount Instructions** tab shows Windows steps instead — the confirmation reads *"Volume is attached — prepare it inside Windows."* — with both a Disk Management walkthrough and PowerShell scripts.

**Using Disk Management:**

1. Connect to the Windows VM using Remote Desktop.
2. Open **Disk Management**, or **Server Manager → File and Storage Services → Disks**.
3. Bring the new disk online if Windows shows it as offline.
4. Initialize the disk as **GPT** (new empty volumes only).
5. Create a **New Simple Volume**, assign a drive letter, and format it with **NTFS**.
6. Verify the drive is **Healthy** and visible in File Explorer.

**Using PowerShell (run as Administrator) — new empty disk:**

```powershell
# 1. Find the newly attached disk
Get-Disk | Sort-Object Number | Format-Table Number,FriendlyName,Size,OperationalStatus,PartitionStyle

# 2. Set the disk number from the output above
$DiskNumber = <disk-number>
Set-Disk -Number $DiskNumber -IsOffline $false
Set-Disk -Number $DiskNumber -IsReadOnly $false

# 3. New empty disk only: initialize, format, and assign drive F:
Initialize-Disk -Number $DiskNumber -PartitionStyle GPT
New-Partition -DiskNumber $DiskNumber -UseMaximumSize -DriveLetter F | Format-Volume -FileSystem NTFS -NewFileSystemLabel "IBEEData" -Confirm:$false

# 4. Verify the drive
Get-Volume -DriveLetter F
```

**Using PowerShell — existing disk that already has data:**

```powershell
Get-Disk | Sort-Object Number | Format-Table Number,FriendlyName,Size,OperationalStatus,PartitionStyle
$DiskNumber = <disk-number>
Set-Disk -Number $DiskNumber -IsOffline $false
Set-Disk -Number $DiskNumber -IsReadOnly $false
Get-Partition -DiskNumber $DiskNumber | Where-Object DriveLetter -Eq $null | Select-Object -First 1 | Set-Partition -NewDriveLetter F
Get-Volume -DriveLetter F
```

> **Warning**
>
> `Initialize-Disk` and `Format-Volume` **erase everything on the disk**. Only run them on a brand-new volume.

## Detach a volume

> **Warning**
>
> **Always unmount the volume inside the guest before detaching in the portal.** Detaching a mounted volume can cause data corruption or filesystem errors.

### 1. Unmount inside the guest

SSH into the server and run the **Unmounting** commands from the **Mount Instructions** tab:

```bash
# 1. Sync pending writes
sync

# 2. Unmount
sudo umount /mnt/data

# 3. Remove from fstab
sudo sed -i '/\/mnt\/data/d' /etc/fstab

# 4. Verify unmounted
lsblk
```

`lsblk` should no longer show the device mounted on `/mnt/data`.

On a **Windows** server, take the disk offline instead. Close any apps using the drive, then run in PowerShell as Administrator:

```powershell
$DriveLetter = "F"
$DiskNumber = (Get-Partition -DriveLetter $DriveLetter).DiskNumber
Set-Disk -Number $DiskNumber -IsOffline $true
```

### 2. Detach in the portal

### Open the volume

Go to **Block Storage** and click your volume. The **Attached To** section shows the server and device path.

### Click Detach

Click **Detach**. The **Detach Volume** dialog opens.

### Confirm unmount

Tick the **I have unmounted this volume from the server before detaching** checkbox. The **Detach** button is disabled until you check it.

### Detach

Click **Detach**. A toast confirms **Volume detached from `<server_id>`**.

After detaching, the volume status returns to **Ready** and the **Attached To** section reverts to **Not attached to any server**. You can now reattach it to any other server in the same region.

## Mount Instructions tab states

The **Mount Instructions** tab content changes depending on attachment state:

| State            | What's shown                                                                                                                                                                        |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Not attached** | Orange **Attach first, then mount** banner explaining that the device path will appear once attached. The mounting commands use `/dev/<guest-disk>` as a placeholder.               |
| **Attached**     | Green **Volume is attached — run these commands inside your server** confirmation with the actual device path (`/dev/vdc`). Both **Mounting** and **Unmounting** scripts are shown. |

## Troubleshooting

**Server dropdown is empty in the Attach dialog**
You don't have a running server in the same region as the volume. Either start a server in that region or create a new volume in your server's region.

**Device path not shown in Mount Instructions**
The device path appears only after the attach completes. Wait a few seconds and refresh the page.

**`lsblk` doesn't show the new disk**
Confirm the attach succeeded (volume status should be **In Use**). If the platform shows attached but the OS doesn't see it, reboot the server.

**Mount doesn't persist after reboot**
Re-run step 6 of the Mounting script and verify the UUID with `sudo blkid /dev/vdc`. The line in `/etc/fstab` should match the actual UUID.

**Detach button disabled**
Tick the unmount confirmation checkbox in the Detach dialog. The button stays disabled until that's confirmed.

**Detach fails or hangs**
The volume is still in use by the guest. Run `sudo lsof /mnt/data` to find processes holding the mount, stop them, then `sudo umount /mnt/data` again before retrying detach.

## Related pages

* [Create a volume](/docs/infrastructure/block-storage/create-a-volume)
* [Delete a volume](/docs/infrastructure/block-storage/create-a-volume#delete-a-volume)
* [Snapshots](/docs/tools/snapshots)