Disk partitions or block devices could be mounted in Linux via device or partition name, partition label, or UUID. UUID ensures the value doesn't unnecessarily change just as a device name would or and avoids conflicting name when using labels.

You can mount partition or block devices in Linux using UUID directly from the terminal or via the fstab.

Steps to mount disk partition by UUID in Linux:

  1. Launch terminal.
  2. Get the UUID for the partition that you want to mount (or set UUID to partition if not yet set).
  3. Create folder to mount the partition into if not already exist.
    $ sudo mkdir -p /mnt/uuidtest
  4. Manually mount partition using UUID to test.
    $ sudo mount UUID=39ea80c4-e748-47eb-835c-64025de53e26 /mnt/uuidtest 
  5. Unmount the newly mounted filesystem.
    $ sudo umount /mnt/uuidtest

  6. Open /etc/fstab using your preferred text editor.
    $ sudo vi /etc/fstab
  7. Add entry to etc/fstab specifying UUID value in the first field (block special device).
    UUID=39ea80c4-e748-47eb-835c-64025de53e26       /mnt/uuidtest   ext4    defaults          0    1

  8. Re-mount using the /etc/fstab entry.
    $ sudo mount /mnt/uuidtest
Discuss the article:

Comment anonymously. Login not required.