To use a disk partition or block device in Linux, it must first be mounted. There are various ways to mount a partition, such as by device or partition name, partition label, or UUID. Mounting via UUID is the most reliable method because the UUID remains consistent, unlike a device name. Additionally, using UUIDs helps avoid potential name conflicts that can occur with labels.

You can manually mount a disk partition or block device in Linux using the UUID through the terminal and add the relevant entries to the fstab file.

Steps to mount disk partition by UUID in Linux:

  1. Open the terminal.
  2. Find the UUID of the partition you want to mount (or assign a UUID to the partition if it doesn't have one).
  3. Create a folder for mounting the partition if one doesn't already exist.
    $ sudo mkdir -p /mnt/uuidtest
  4. Temporarily mount the partition using the UUID to test the process.
    $ sudo mount UUID=39ea80c4-e748-47eb-835c-64025de53e26 /mnt/uuidtest 
  5. Unmount the filesystem you just mounted.
    $ sudo umount /mnt/uuidtest
  6. Open the /etc/fstab file with your preferred text editor.
    $ sudo vi /etc/fstab
  7. Add an entry to /etc/fstab, including the UUID in the first field (block special device).
    UUID=39ea80c4-e748-47eb-835c-64025de53e26       /mnt/uuidtest   ext4    defaults          0    1

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

Comment anonymously. Login not required.