Photo by Sai Kiran Anagani / Unsplash

How to mount disk partition using UUID | Linux

Linux Nov 9, 2021

Open terminal and create folder where you want to mount new disk.

sudo mkdir -p /disk2

Check UUID with blkid command:

blkid
/dev/vdb: UUID="a8c95a57-8282-4fe4-a694-9badd965e8be" TYPE="ext4"

We can manually mount using:

sudo mount UUID=a8c95a57-8282-4fe4-a694-9badd965e8be /disk2

To unmount simply do:

sudo umount /disk2

For mount to work after reboot add line in /etc/fstab

sudo nano /etc/fstab
UUID=a8c95a57-8282-4fe4-a694-9badd965e8be       /disk2   ext4    defaults          0    2

After adding it in fstab you can mount using command:

sudo mount /disk2

That's it!

Tags