How to mount filesystem by using UUID
The device can be identified by a full path to a block device (for example,/dev/sda3) , a universally unique identifier (UUID; for example,UUID=3bf2d836-be7d-4e69-a1ff-4ffd2661edcf) , or a volume label (for example,LABEL=home). The device node name of a disk (/dev/sda, /dev/hda, /dev/vda, etc.) may change in some situations. For example, after switching cables around or upgrading certain packages, sda & sdc could swap places. This causes problems when /etc/fstab references filesystems by the disk names.
- Determine the UUID of a Particular Device.
# blkid /dev/sdb1
/dev/sdb1: UUID="3bf2d836-be7d-4e69-a1ff-4ffd2661edcf" TYPE="ext4"
- Edit the/etc/fstabfile and change the device path with the UUID of the file system, for example:
# vi /etc/fstab
UUID=3bf2d836-be7d-4e69-a1ff-4ffd2661edcf /mnt/myfolder ext4 defaults 0 0
During the next reboot of the computer, the filesystem will be mounted using the UUID.