Mounting a filesystem by UUID keeps the correct disk partition attached to the correct directory even when kernel device names such as /dev/vdb1 change after a reboot, storage-controller change, or added disk. Stable mounts matter for data volumes, backup targets, and application directories that must always appear at the same path.
Each filesystem stores its own UUID in metadata on the disk, and the Linux mount stack can resolve UUID=… in a direct mount command or in /etc/fstab. Tools such as blkid read the exact identifier and filesystem type, while findmnt confirms that the saved entry resolves to the intended block device and mount point.
The command flow below was verified on Ubuntu 24.04 with an ext4 filesystem, but the same pattern applies on other current Linux distributions. Replace the device path, mount point, filesystem type, mount options, and final /etc/fstab field to match the actual filesystem, because a wrong entry can leave the volume unavailable or delay boot until the file is corrected.
Steps to mount disk partitions by UUID in Linux:
- Open a terminal with a user account that can run sudo.
- List block devices to identify the target partition and confirm that it is not already mounted.
$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS NAME SIZE TYPE MOUNTPOINTS nvme0n1 100G disk ├─nvme0n1p1 512M part /boot/efi └─nvme0n1p2 99.5G part / vdb 64G disk └─vdb1 64G part
The target is usually a partition such as /dev/vdb1 or /dev/nvme1n1p1 rather than the whole-disk node.
- Read the target partition metadata to get the exact UUID and filesystem type.
$ sudo blkid /dev/vdb1 /dev/vdb1: LABEL="data" UUID="3f5e6c0d-2c2f-4a7f-b2b7-a1d4fd6c9ec4" BLOCK_SIZE="4096" TYPE="ext4"
blkid provides the exact identifier and filesystem type to use in the mount command and in /etc/fstab.
- Create an empty directory to use as the mount point.
$ sudo mkdir -p /mnt/data
Files already present in /mnt/data stay hidden until the mounted filesystem is unmounted.
- Test the partition with a direct UUID mount before saving persistent configuration.
$ sudo mount UUID=3f5e6c0d-2c2f-4a7f-b2b7-a1d4fd6c9ec4 /mnt/data $ findmnt --target /mnt/data --output TARGET,SOURCE,FSTYPE,OPTIONS TARGET SOURCE FSTYPE OPTIONS /mnt/data /dev/vdb1 ext4 rw,relatime
A successful test mount proves that the UUID resolves to the intended filesystem and mount point.
- Unmount the test mount after confirming that the correct filesystem is attached at the correct path.
$ sudo umount /mnt/data
- Back up the current /etc/fstab file before changing boot-time mount configuration.
$ sudo cp --archive /etc/fstab /etc/fstab.bak
A malformed /etc/fstab entry can prevent the system from mounting the volume at boot and can delay boot until the file is corrected.
- Open the /etc/fstab file in an editor with root privileges.
$ sudoedit /etc/fstab
- Add a new line that uses the UUID instead of the raw device path.
UUID=3f5e6c0d-2c2f-4a7f-b2b7-a1d4fd6c9ec4 /mnt/data ext4 defaults 0 2
The fields are, in order, the source, mount point, filesystem type, mount options, dump flag, and filesystem check order.
Use 0 0 instead of 0 2 for filesystems that fsck does not check at boot, such as XFS, or when boot-time checking is not wanted. Options such as defaults,nofail are useful for removable or occasionally missing storage.
- Verify the saved /etc/fstab entry before relying on it at boot.
$ sudo findmnt --verify --verbose /mnt/data /mnt/data [ ] target exists [ ] UUID=3f5e6c0d-2c2f-4a7f-b2b7-a1d4fd6c9ec4 translated to /dev/vdb1 [ ] source /dev/vdb1 exists [ ] FS type is ext4 Success, no errors or warnings detected
If findmnt reports an error, correct the /etc/fstab line before mounting or rebooting.
- Mount the saved entry by its mount point.
$ sudo mount /mnt/data $ findmnt /mnt/data TARGET SOURCE FSTYPE OPTIONS /mnt/data /dev/vdb1 ext4 rw,relatime
When the mount point exists in /etc/fstab, mount can use the target path instead of the raw device name.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
