Date: 2010mar3
OS: Linux
Language: mixed
Q. Linux: How do I find a disk's unique ID?
A. This command shows the unique IDs:
ls -l /dev/disk/by-uuid
Example output:
total 0
lrwxrwxrwx 1 root root 10 Apr 29 01:36 13758cdf-5219-4b8f-9999-872731169999 -> ../../sda1
lrwxrwxrwx 1 root root 15 Apr 29 01:36 6bd15614-1d8c-483d-9999-baa500579999 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Apr 29 01:36 abf33597-ca47-4caf-9999-3bbd1b999999 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Apr 29 01:36 CBE3-43C7 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 11 Apr 29 01:36 d420585a-1b4a-49f3-9999-599485c59999 -> ../../zram0
Some numbers were redacted.
You can filter with grep, for example:
ls -l /dev/disk/by-uuid | grep n1p3
Example output:
lrwxrwxrwx 1 root root 15 Apr 29 01:36 abf33597-ca47-4caf-9999-3bbd1b999999 -> ../../nvme0n1p3