Unique identifier for each storage device
UUID is the "universally unique identifier" that is assigned to devices on a linux system for the purpose of identification.
For example if your hard disk has 3 partitions then each partition is a device and has a uuid. Similarly cd/dvd, usb drives etc all are assigned a uuid.
On a ubuntu system for example you might find that a partition is mounted at a location like this
/media/fc474ef9-60b7-4cf8-b42a-7feb63eeb64c/
Now the part after media/ is the uuid and used as the directory name where a certain device has been mounted. To find the uuid of devices connected to a system use the following commands
$ ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 Mar 3 09:45 14348F74348F581E -> ../../sda9 lrwxrwxrwx 1 root root 10 Mar 3 09:45 2A64794864791831 -> ../../sda1 lrwxrwxrwx 1 root root 10 Mar 3 09:45 2edfb41d-54f4-478e-8cc0-0fe9864596a8 -> ../../sda8 lrwxrwxrwx 1 root root 10 Mar 3 09:45 31a6807b-3b3e-4f9d-95c2-ead64d0c7009 -> ../../sda6 lrwxrwxrwx 1 root root 10 Mar 3 09:45 9de0aab4-e64c-49c8-af55-cc7375a97dd6 -> ../../sda5 lrwxrwxrwx 1 root root 10 Mar 3 09:45 eba07f1f-b287-456a-b3d6-1c40d7b28a60 -> ../../sda7 lrwxrwxrwx 1 root root 10 Mar 3 12:20 fc474ef9-60b7-4cf8-b42a-7feb63eeb64c -> ../../sdb1
The ls command has been used to get a list of all devices along with the uuids. The big uuids are ext4 or swap type partitions. Whereas the short uuid are ntfs type partitions.
1. blkid
Another command that can be used to perform the same task is blkid. Here are some quick examples on using it.
$ sudo blkid /dev/sda1: UUID="2A64794864791831" TYPE="ntfs" /dev/sda5: UUID="9de0aab4-e64c-49c8-af55-cc7375a97dd6" TYPE="ext4" /dev/sda6: UUID="31a6807b-3b3e-4f9d-95c2-ead64d0c7009" TYPE="swap" /dev/sda7: UUID="eba07f1f-b287-456a-b3d6-1c40d7b28a60" TYPE="ext4" /dev/sda8: UUID="2edfb41d-54f4-478e-8cc0-0fe9864596a8" TYPE="ext4" /dev/sda9: UUID="14348F74348F581E" TYPE="ntfs" /dev/sdb1: UUID="fc474ef9-60b7-4cf8-b42a-7feb63eeb64c" TYPE="ext4"
The output of blkid clearly shows the device, its uuid and the format type. Useful information. To get the uuid of a specific device, simply put the device name next to blkid like this
$ sudo blkid /dev/sda1 /dev/sda1: UUID="2A64794864791831" TYPE="ntfs"
2. lsblk
The lsblk command is another very useful and powerful command to check details about storage devices on a system.
Here is a quick example:
$ lsblk -o PATH,SIZE,RO,TYPE,MOUNTPOINT,UUID,MODEL PATH SIZE RO TYPE MOUNTPOINT UUID MODEL /dev/loop0 96.5M 1 loop /snap/core/9436 /dev/loop1 229.6M 1 loop /snap/atom/257 /dev/loop2 55M 1 loop /snap/core18/1880 /dev/loop3 54.8M 1 loop /snap/gtk-common-themes/1502 /dev/loop4 156.2M 1 loop /snap/chromium/1213 /dev/loop5 55M 1 loop /snap/core18/1754 /dev/loop6 62.1M 1 loop /snap/gtk-common-themes/1506 /dev/loop7 230.6M 1 loop /snap/atom/258 /dev/loop8 158.4M 1 loop /snap/chromium/1229 /dev/loop9 97M 1 loop /snap/core/9665 /dev/sda 465.8G 0 disk Samsung_Portable_SSD_T5 /dev/sda1 420G 0 part 757dcceb-3e17-4ca8-9ba1-b0cf68fb0134 /dev/sdb 111.8G 0 disk Samsung_SSD_840_EVO_120GB /dev/sdb1 95.4G 0 part / 19d84ceb-8046-4f8d-a85a-cda49515d92c /dev/sdc 111.8G 0 disk Samsung_SSD_850_EVO_120GB /dev/sdc1 95.8G 0 part f41b21a7-e8be-48ac-b10d-cad641bf709b enlightened@desktop:~$
The lsblk command shows a lot of details about storage devices like mount point, device name, uuid, model name. The device name and UUID are needed when you need to mount a device to access its contents.
highly appreciate this post
thx for sharing
have fun
aum
s love nia
The title of your post here is incorrect: you are mentioning ONLY the UUID of storage devices. Other devices have UUID’s as well, devices such as network cards/ports
thanks for pointing out.