> 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/format-and-mount-a-volume.md).

# Format and mount a volume

A block storage volume is a raw device. Before you can mount and use it in the operating system, you need to create a partition table and a filesystem on it.

***

A newly created block storage volume is completely blank. It doesn't contain a partition table, partitions, or filesystems. Before you can use the volume, you need to create these things on the volume.

{% hint style="warning" %}
Always match the WWN shown in the control panel to the WWN shown in the operating system when working with volumes, especially when formatting. This avoids formatting the wrong disk or volume. Formatting a volume or disk will erase everything on it!
{% endhint %}

## Create a filesystem on the volume

{% tabs %}
{% tab title="Linux" %}
List the files in `/dev/disk/by-id/` and look for the WWN that matches the WWN from the control panel.  For example, if the WWN in the control panel is `3fa0d41402141ef7`, then the file in `/dev/disk/by-id/` will be `wwn-0x3fa0d41402141ef7`. This file represents the volume.

<pre data-title="Command and output. Command is highlighted."><code><strong>ls /dev/disk/by-id/
</strong>ata-QEMU_DVD-ROM_QM00001       scsi-33fa0d41402141ef7
ata-QEMU_DVD-ROM_QM00003       wwn-0x305b0264d59532e7
scsi-3305b0264d59532e7         wwn-0x305b0264d59532e7-part1
scsi-3305b0264d59532e7-part1   wwn-0x305b0264d59532e7-part14
scsi-3305b0264d59532e7-part14  wwn-0x305b0264d59532e7-part15
scsi-3305b0264d59532e7-part15  wwn-0x3fa0d41402141ef7
</code></pre>

First, create a partition table and a partition on the new volume. Double-check the WWN to avoid wiping the wrong disk or volume! When using the `print` command in `parted`, also make sure that the model says `GLESYS REMOTE DISK`. This indicates the disk you are working on is a block storage volume, not the main disk of the virtual machine.

<pre data-title="Commands and output. Commands are highlighted. (parted) is the prompt inside the parted program."><code><strong>sudo parted /dev/disk/by-id/wwn-0x3fa0d41402141ef7
</strong>GNU Parted 3.6
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
<strong>(parted) print
</strong>Error: /dev/sdb: unrecognised disk label
Model: GLESYS REMOTE DISK (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 4096B/4096B
Partition Table: unknown
Disk Flags:
<strong>(parted) mklabel gpt
</strong><strong>(parted) mkpart primary 1MiB 100%
</strong><strong>(parted) quit
</strong>Information: You may need to update /etc/fstab.
</code></pre>

You should now have a partition on the volume; verify it by listing all files related to the WWN.

<pre data-title="Command and output. Command is highlighted."><code><strong>ls /dev/disk/by-id/wwn-0x3fa0d41402141ef7*
</strong>/dev/disk/by-id/wwn-0x3fa0d41402141ef7
/dev/disk/by-id/wwn-0x3fa0d41402141ef7-part1
</code></pre>

Now, let's create a filesystem on the partition, `part1`. To not reserve any storage space on the partition for the root user, include the `-m 0` option as shown in the command below. Otherwise, exclude it (which will default to reserving 5% of the storage space for the root user).

<pre data-title="Command and output. Command is highlighted."><code><strong>sudo mkfs.ext4 /dev/disk/by-id/wwn-0x3fa0d41402141ef7-part1 -m 0
</strong>mke2fs 1.47.2 (1-Jan-2025)
Discarding device blocks: done
Creating filesystem with 2620928 4k blocks and 655360 inodes
Filesystem UUID: a5eb2aa7-4a01-463a-baca-17cfa07a861d
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
</code></pre>

Finally, verify that everything looks correct.

<pre data-title=""><code><strong>lsblk -o NAME,FSTYPE,WWN
</strong>NAME    FSTYPE  WWN
sda             0x305b0264d59532e7
├─sda1  ext4    0x305b0264d59532e7
├─sda14         0x305b0264d59532e7
└─sda15 vfat    0x305b0264d59532e7
sdb             0x3fa0d41402141ef7
└─sdb1  ext4    0x3fa0d41402141ef7
sr0
sr1     iso9660
</code></pre>

Here we'll see that the volume with WWN `3fa0d41402141ef7` has a partition with an *ext4* filesystem.
{% endtab %}

{% tab title="Windows Server (GUI)" %}
Start by verifying which drive corresponds to the WWN on the virtual server with the WWN in the control panel. This will avoid operating on the wrong disk.

Start a PowerShell terminal and run the following command (search for ***Terminal*** or ***PowerShell*** in the Start menu).&#x20;

Look for the WWN from 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 case, 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 **Online**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2F2vXbE1Cel8WCdrchR1Yp%2Fwindows-server-2025-disk-management.png?alt=media&amp;token=11e72a7d-db81-4a22-8c7b-7f84dd2a5427" alt=""><figcaption></figcaption></figure>

Right-click the same disk again, but this time select **Initialize Disk**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FIHcEJFE3GsKYPDWaQFSy%2Fwindows-server-2025-disk-management-1.png?alt=media&amp;token=7a4131d4-1c9e-4e1e-9436-b30a3b697624" alt=""><figcaption></figcaption></figure>

Leave the defaults as-is in the dialog box (**Disk 1** and **GPT**). Click **OK**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FRUVfOYavSXqBWXMcxFuN%2Fwindows-server-2025-initialize-disk.png?alt=media&amp;token=3c974d08-da5a-43bd-8fe3-1a717974742c" alt=""><figcaption></figcaption></figure>

Right-click on the unallocated disk space and select **New Simple Volume...**

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FnheIY0SgGAaB3uZUusZe%2Fwindows-server-2025-new-simple-volume.png?alt=media&amp;token=076356c3-079c-4eae-8f0c-cbff82a0d95a" alt=""><figcaption></figcaption></figure>

Click **Next** to start the guide. Leave the default size value to use the entire volume. Click **Next**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FG8r9vWFLIIH1b37MOHxi%2Fwindows-server-2025-size-of-new-volume.png?alt=media&amp;token=99ce3456-7eed-4b51-aa36-0cbe1ffad590" alt=""><figcaption></figcaption></figure>

Select a desired drive letter for the new volume, or leave it at the default. Click **Next**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FZgs9WKVmxgzJ1vBv63IE%2Fwindows-server-2025-drive-letter-and-path.png?alt=media&amp;token=f5c99609-0090-42a9-b56c-9eac9f04588d" alt=""><figcaption></figcaption></figure>

Leave all the default settings as-is (Filesystem: NTFS, Allocation unit size: Default), but give the volume a label so you can identify it later. Here, we've given it the name *Block Storage 1*.

Make sure **Perform a quick format** is checked.

Click **Next**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FWX7uwtJkD2f8bc7wy3kZ%2Fwindows-server-2025-format-disk.png?alt=media&amp;token=16afc991-88f9-466d-9081-6e8241021837" alt=""><figcaption></figcaption></figure>

If everything looks okay in the summary, click **Finish**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2F4Li46fMISxVaLvCWhY4R%2Fwindows-server-2025-disk-summary.png?alt=media&amp;token=2adaeec3-b2f3-454b-824f-38f65cc3c7dc" alt=""><figcaption></figcaption></figure>

Once the volume is formatted, you'll find it under **This PC**, just like any other drive.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2F4uHLzHCbmEiyNrhCk0cz%2Fwindow-server-2025-this-pc.png?alt=media&amp;token=8764efc6-7321-4367-8db2-faf3c8bbd421" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Windows Server (PowerShell)" %}
Start by verifying which disk in the virtual machine corresponds to the WWN assigned to the volume in the control panel.

Start a PowerShell terminal and run the following command (search for ***Terminal*** or ***PowerShell*** in the Start menu).&#x20;

Look for the WWN in the output below and match it to the WWN your volume was assigned in the control panel.

<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 34BE872B548D6EB9
</code></pre>

In this case, disk number 1 matches the WWN from the control panel. Disk number 1 also has the friendly name *GLESYS REMOTE DISK*, indicating that this is a block storage volume and not the local disk. From now on, we'll reference the disk as disk number 1.

Take the disk online (new disks are always offline).

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

Initialize the disk with a GPT partition table.

<pre data-title="Command"><code><strong>Initialize-Disk -Number 1 -PartitionStyle GPT
</strong></code></pre>

Create a partition on the volume. Here we'll choose to use the entire volume's storage space.

<pre data-title="Command and output. Command is highlighted."><code><strong>New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter
</strong>

   DiskPath: \\?\scsi#disk&#x26;ven_glesys&#x26;prod_remote_disk#5&#x26;83f7dc4&#x26;0&#x26;000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                        Size Type
---------------  ----------- ------                                        ---- ----
2                F           16777216                                  19.98 GB Basic
</code></pre>

In the example above, the new partition got assigned drive letter **F**.

As a last step, you'll have to format the new partition. In this example, we'll format it as NTFS. Make sure to match the drive letter from the above step (in this example, **F**). You can set the filesystem label to something else; it's just a friendly name.

<pre data-title="Command and output. Command is highlighted."><code><strong>Format-Volume -DriveLetter F -FileSystem NTFS -NewFileSystemLabel "Block storage volume 1"
</strong>
DriveLetter FriendlyName           FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining     Size
----------- ------------           -------------- --------- ------------ ----------------- -------------     ----
F           Block storage volume 1 NTFS           Fixed     Healthy      OK                     19.93 GB 19.98 GB
</code></pre>

Once the volume is formatted, you'll find it under **This PC**, just like any other drive.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FxKGBp0igSHGE84rP7SS4%2Fwindows-server-2025-ps-this-pc.png?alt=media&amp;token=e0e79c35-b3c4-4273-b1d1-658d9e65d3eb" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Mount the volume in Linux

Start by creating a mount point for the volume, for example, under `/mnt`.

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

### Temporarily mount the volume

To temporarily mount the volume until the next reboot, or until you choose to unmount it, use the mount command.

<pre data-title="Command"><code><strong>sudo mount /dev/disk/by-id/wwn-0x3fa0d41402141ef7-part1 /mnt/volume1/
</strong></code></pre>

If no error messages appeared, the volume is now mounted at `/mnt/volume1/`. You can verify this with `lsblk`.

<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>

#### Unmount the volume

To unmount the volume, use the `umount` command.

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

### Automatically mount the volume on boot

#### Introduction to nofail

There's an important choice to make when automounting the volume on boot. Should the VM continue booting if the volume has been detached? The default setting in Linux is not to boot the VM if the volume is missing.

The downside of using the default setting is that the VM won't boot if you forget to remove the automount when detaching or deleting the volume. To fix it, you'll have to boot the VM into single-user mode and remove the volume from `/etc/fstab`.

However, this is also the upside. For example, if you have a background job, such as a backup script, that writes data to `/mnt/volume1` where the volume is usually mounted, and the volume is removed through the control panel and the VM is rebooted, the script would write the data to the local drive instead (since nothing is mounted on `/mnt/volume1`, making it just a regular directory).

To let the VM boot even if the volume is missing, you add the `nofail` option to the mount in `/etc/fstab`. The upside is that even if you forget to remove the mount after having detached it through the control panel, the VM will still boot (after a timeout of 90 seconds, depending on the distribution). But then again, this is also the downside, as mentioned above.

There is also a nice middle-ground. If a script or service that writes data to the volume is a `systemd`-based service, you can add `RequiresMountsFor=/mnt/volume1` and `BindsTo=mnt-volume1.mount` to that service's `systemd`-file, and use `nofail` for the mount in `/etc/fstab`. If the volume is missing, the mount will fail and stop the service that uses the volume (even while the VM is running). At the same time, the VM will still be able to reboot without the volume. We'll show an example in the guide [Stopping a systemd service when a volume is detached](https://docs.glesys.com/products/storage/block-storage/how-tos/stop-a-systemd-service-when-a-volume-is-detached-linux.md).

#### Set up /etc/fstab

We'll use the same examples as above: WWN `3fa0d41402141ef7` for the volume, and `/mnt/volume1` for the mount point. Adjust these values to fit your own volume and environment.

In case you haven't created the mount point yet, do so now.

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

Add the following line to `/etc/fstab` as root (or using `sudo`), but adjust the WWN and mount point to your own volume and environment. Choose with or without `nofail` depending on your preference and environment.

{% tabs %}
{% tab title="With nofail" %}
{% code title="New line in /etc/fstab" %}

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

{% endcode %}
{% endtab %}

{% tab title="Without nofail" %}
{% code title="New line in /etc/fstab" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

Restart the `systemd` daemon so it recognizes the new mount (`systemd` actually handles mounts, even from `/etc/fstab`).

<pre data-title="Command"><code><strong>sudo systemctl daemon-reload
</strong></code></pre>

The volume will now automatically mount every time the VM boots.

You can test the new line in `/etc/fstab` before rebooting by mounting the volume manually using only its mount point.

<pre data-title="Command and output. Command is highlighted."><code><strong>sudo mount /mnt/volume1
</strong></code></pre>

The volume should now be mounted in `/mnt/volume1`. Verify it using `lsblk`.

<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>
