RHEL - Mounting Partitions using UUID and LABEL
In this article, I will explain how to mount partition from beginning.
I have added a new disk to my virtual machine running in VMware workstation
1. Open the terminal and run lsblkd
2. Then run parted with selected disk device with elevated privilege
sudo parted /dev/nvme0n3 print // to see the result mklabel gpt
3. create a 1 Gb partition using mkpart
mkpart primary ext4 1MiB 1024MiB quit
update the device and create a folder mymount1 to mount the newly created drive
udevadm settle sudo mkdir /mymount1
4. Format and I tried to mount it using
mkfs.ext4 /dev/nvme0n3p1 sudo mount /dev/nvme0n3p1 /mymount1
But this is a temporary mount, not added to the fstab.
5. To add to fstab, we have two option. using UUID or label.
In order to use UUID, run blkid and find the UUID of new partition, and then add to fstab
6. To create a label, run the following
sudo tune2fs -L mylabel /dev/nvme0n3p1
7. Add entry to fstab with new label
8. Run mount -a.