Skip to main content

Make Your Volume Available for Use on Linux

After you attach a block storage volume to your node, it is exposed as a block device. You must format the volume with a filesystem and mount it before use. Once mounted, you can access the volume like any other directory, and all data written to it is stored on the attached block storage volume.

Suppose your node has a root device as /dev/vda1, and you have attached a new empty volume using /dev/vdb.
The following steps explain how to make this volume available for use.


1. Connect to Your Instance

Log in to your instance using SSH.

ssh <username>@<public-ip>

2. List Available Disks

List all attached block devices to identify your new volume:

lsblk

This displays all available disks and their mount points (if any). You can identify your attached volume (for example, /dev/vdb) by checking which device is unmounted.


3. Check if the Volume Has a Filesystem

Use the following command to verify if the attached volume is empty or already formatted:

sudo file -s /dev/vdb
  • If the output shows data, the volume has no filesystem and needs formatting.
  • If it shows a type like XFS or ext4, it already has a filesystem (for example, if created from a snapshot).

4. Create filesystem (if Empty)

If the volume is empty, create a filesystem using mkfs. This example uses XFS, but you can also use ext4 depending on your needs.

sudo mkfs -t xfs /dev/vdb
danger

This command erases all existing data on the volume. Do not run this if the volume was created from a snapshot or already contains data.

If you get an error like mkfs.xfs: command not found, install the XFS utilities:

sudo yum install -y xfsprogs
# or on Ubuntu
sudo apt install -y xfsprogs

5. Create a Mount Point

Create a directory where you will mount the volume (for example, /data):

sudo mkdir /data

6. Mount the Volume

Mount the formatted volume to the directory you created:

sudo mount /dev/vdb /data

You can now verify that the filesystem is mounted successfully:

df -h

7. Unmount the Volume (Optional)

To safely unmount the volume:

sudo umount /data

8. Make the Mount Persistent After Reboot

Mount points are not automatically preserved after a reboot. To ensure your volume mounts automatically at startup, you must add it to the /etc/fstab file using its UUID.

Step 1: Find the UUID

Run the following command to get the UUID of the volume:

sudo blkid /dev/vdb

Example output:

/dev/vdb: UUID="e7c5b2f2-8b2a-4e13-b9a9-bb3f122a91f1" TYPE="xfs"

Step 2: Edit /etc/fstab

Open the file in an editor:

sudo nano /etc/fstab

Add the following line at the end (replace the UUID with your own):

UUID=e7c5b2f2-8b2a-4e13-b9a9-bb3f122a91f1   /data   xfs   defaults,nofail   0   2

Step 3: Verify Configuration

Apply the configuration and check for errors:

sudo mount -a

If no errors appear, your setup is correct. Reboot the node to confirm persistence:

sudo reboot

After reboot, verify that the mount is active:

df -h

You should see /data listed as mounted.


note
  • Volumes created from snapshots typically already include a filesystem — skip formatting in such cases.
  • Always verify the device name using lsblk before running mkfs to avoid data loss.
  • You can use ext4 instead of xfs if preferred — adjust commands accordingly.
  • For DR resources, use persistent mounts via UUID to ensure consistent behavior across reboots or recoveries.