Skip to content

Mounting a Disk on Linux

After you attach a volume to the server in the client area, you typically need to create a partition and file system and mount the device in Linux. Formatting removes any previous data on the disk, if present. New virtual disks are usually empty and require one-time formatting on first attach. The steps below assume root access over SSH.

Identifying the New Disk

On Linux, each disk has a name and path. You can find the new disk in recent log entries: /var/log/messages on Red Hat Enterprise Linux, CentOS, AlmaLinux, and Rocky Linux, or /var/log/syslog on Debian and Ubuntu.

You can also run fdisk -l to list all disks.

If you previously had only one disk, the second one is often /dev/vdb.

Always verify the device name before making changes. Selecting the wrong disk or partition can cause irreversible data loss.

Creating a Partition

The usual tool is fdisk. If the new disk is /dev/vdb, run:

fdisk /dev/vdb

Then choose n, then 1, then p, and finally w to write the changes.

Creating a File System

Linux supports several file types. If you have no preference, ext4 is a solid default. For partition 1 on /dev/vdb (i.e. /dev/vdb1), run:

mkfs.ext4 /dev/vdb1

Mounting the Disk

To use the disk, mount it to a directory of your choice.

One-Time Mount

For example:

mount /dev/vdb1 /mnt

This mounts the disk at /mnt. You may use another existing directory instead.

Mounting on Every Boot

  1. Edit /etc/fstab and add a line such as:
/dev/vdb1    /mnt    ext4    defaults     0 2
  1. Validate with mount -a.

The line above is an example—adjust the device path and mount point to match your environment.