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.
Create a filesystem on the volume
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.
ls /dev/disk/by-id/
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-0x3fa0d41402141ef7First, 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.
sudo parted /dev/disk/by-id/wwn-0x3fa0d41402141ef7
GNU Parted 3.6
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
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:
(parted) mklabel gpt
(parted) mkpart primary 1MiB 100%
(parted) quit
Information: You may need to update /etc/fstab.You should now have a partition on the volume; verify it by listing all files related to the WWN.
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).
Finally, verify that everything looks correct.
Here we'll see that the volume with WWN 3fa0d41402141ef7 has a partition with an ext4 filesystem.
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).
Look for the WWN from the control panel and match it to a disk.
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.

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

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

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

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

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

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.

If everything looks okay in the summary, click Finish.

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

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).
Look for the WWN in the output below and match it to the WWN your volume was assigned in the control panel.
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).
Initialize the disk with a GPT partition table.
Create a partition on the volume. Here we'll choose to use the entire volume's storage space.
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.
Once the volume is formatted, you'll find it under This PC, just like any other drive.

Mount the volume in Linux
Start by creating a mount point for the volume, for example, under /mnt.
Temporarily mount the volume
To temporarily mount the volume until the next reboot, or until you choose to unmount it, use the mount command.
If no error messages appeared, the volume is now mounted at /mnt/volume1/. You can verify this with lsblk.
Unmount the volume
To unmount the volume, use the umount command.
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.
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.
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.
Restart the systemd daemon so it recognizes the new mount (systemd actually handles mounts, even from /etc/fstab).
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.
The volume should now be mounted in /mnt/volume1. Verify it using lsblk.
Last updated
Was this helpful?