[*] -  SecureInfo.eu, /System/fstab-UUID.md

Back


UUID Partitions

Source: https://www.cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab/

/etc/fstab

To probe the Linux filesystem type and read label and uuid for /dev/sdb2 (or any other device) use the vol_id or blkid command. For example:

vol_id --uuid {/dev/device}
vol_id --uuid /dev/sdb2
sudo blkid /dev/sdb2
sudo vol_id --uuid /dev/sdb2

Sample output:

41c22818-fbad-4da6-8196-c816df0b7aa8
sudo blkid

Here is what I see:

/dev/sda1: TYPE="ntfs" UUID="A0F0582EF0580CC2" 
/dev/sda2: UUID="8c2da865-13f4-47a2-9c92-2f31738469e8" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sda3: TYPE="swap" UUID="5641913f-9bcc-4d8a-8bcb-ddfc3159e70f" 
/dev/sda5: UUID="FAB008D6B0089AF1" TYPE="ntfs" 
/dev/sdb1: UUID="32c61b65-f2f8-4041-a5d5-3d5ef4182723" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sdb2: UUID="41c22818-fbad-4da6-8196-c816df0b7aa8" SEC_TYPE="ext2" TYPE="ext3" 

How do I use UUID to update /etc/fstab file under Linux? Simply use following syntax:

UUID={YOUR-UID}    {/path/to/mount/point}               {file-system-type}    defaults,errors=remount-ro 0       1

Open the /etc/fstab using a text editor such as vim or nano or emacs. For example: sudo vim /etc/fstab

Append line as follows:

UUID=41c22818-fbad-4da6-8196-c816df0b7aa8  /disk2p2      ext3    defaults,errors=remount-ro 0       1

Save and close the file. To mount new partition immediately using the /etc/fstab type: sudo mount -a

Here is my sample /etc/fstab file displayed using the more/less/bat or cat command: cat /etc/fstab

⬆️ Top
admin