Disk partition or block device needs to be mounted before it can be used. Linux supports mounting via device or partition name, partition label, or UUID. Mounting via UUID is the most reliable way as the UUID value doesn't change just as a device name would. It also avoids possible name conflict when using labels.

You can mount disk partition or block device 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.