How to list UUID, FSTYPE , LABEL of storage devices in a llinux system ?

Humble Devassy Chirammal Forums Linux Questions & Answers.. Filesystem .. How to list UUID, FSTYPE , LABEL of storage devices in a llinux system ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2477 Reply
    Humble
    Keymaster

    One of the ways to list this information is “lsblk” command : In raw state it lists the block devices:

    lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem to gather information.

    The command prints all block devices (except RAM disks) in a tree-like format by default. Use lsblk –help to get a list of all available columns.

    The default output, as well as the default output from options like –fs and –topology, is subject to change. So whenever possible, you
    should avoid using default outputs in your scripts. Always explicitly define expected columns by using –output columns-list in environments where a stable output is required.

    [root@humbles-lap]# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 698.7G 0 disk
    ├─sda1 8:1 0 1000M 0 part
    ├─sda2 8:2 0 260M 0 part /boot/efi
    ├─sda3 8:3 0 1000M 0 part
    ├─sda4 8:4 0 128M 0 part
    ├─sda5 8:5 0 327.8G 0 part
    ├─sda6 8:6 0 25G 0 part
    ├─sda7 8:7 0 20G 0 part
    ├─sda8 8:8 0 4.9G 0 part /boot
    ├─sda9 8:9 0 195.3G 0 part /home
    ├─sda10 8:10 0 48.8G 0 part /
    ├─sda11 8:11 0 9.8G 0 part [SWAP]
    └─sda12 8:12 0 1M 0 part
    sr0 11:0 1 1024M 0 rom
    loop0 7:0 0 20G 0 loop
    [root@humbles-lap ]#

    If you want to list “filesystem” information , please try:

    [root@humbles-lap ]# lsblk –fs
    NAME FSTYPE LABEL UUID MOUNTPOINT
    sda
    ├─sda1 ntfs WINRE_DRV 7870EA4270EA06AA
    ├─sda2 vfat SYSTEM_DRV 4EEC-B38E /boot/efi
    ├─sda3 vfat LRS_ESP 0CED-2AB9
    ├─sda4
    ├─sda5 ntfs Windows8_OS 429CF07E9CF06E33
    ├─sda6 ntfs LENOVO 4228F2B328F2A4D7
    ├─sda7 ntfs PBR_DRV F63AF44D3AF40BFD
    ├─sda8 ext4 /boot 3ba53f9b-f44b-4c3f-aaa2-0dfbbb75b1e5 /boot
    ├─sda9 ext4 /home 20ad6689-b5a3-4ec3-a9f4-e81d6360ca58 /home
    ├─sda10 ext4 / 6da5e19a-e9e8-4ad0-a04f-aeaca04035a2 /
    ├─sda11 swap swap d080a09a-3b45-48d7-9410-ba3b07443388 [SWAP]
    └─sda12
    sr0
    loop0 LVM2_member Yg52hp-YO2R-7QOr-11PV-fdC6-nqE1-Af0pS1

    #2478 Reply
    Humble
    Keymaster

    Also you can use “blkid” command:

    For ex:

    [root@humbles-lap ]# blkid
    /dev/loop0: UUID="Yg52hp-YO2R-7QOr-11PV-fdC6-nqE1-Af0pS1" TYPE="LVM2_member" 
    /dev/sda1: LABEL="WINRE_DRV" UUID="7870EA4270EA06AA" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e5c49970-3e0d-4d76-b024-766f64258989" 
    /dev/sda2: LABEL="SYSTEM_DRV" UUID="4EEC-B38E" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="db3d31b3-05f9-4101-9bbf-1425fd68edb2" 
    /dev/sda3: LABEL="LRS_ESP" UUID="0CED-2AB9" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="a56b6cb2-e516-48f3-9adf-35cd11e76e54" 
    /dev/sda4: PARTLABEL="Microsoft reserved partition" PARTUUID="7df2f17d-9751-4a77-828e-2bf7311c3a1f" 
    /dev/sda5: LABEL="Windows8_OS" UUID="429CF07E9CF06E33" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ad68292e-0517-4bff-b925-899dbe5ab015" 
    /dev/sda6: LABEL="LENOVO" UUID="4228F2B328F2A4D7" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="495f8d21-0a95-4383-86cc-12f6c7d7bbeb" 
    /dev/sda7: LABEL="PBR_DRV" UUID="F63AF44D3AF40BFD" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="368b12c6-c47f-4c1b-acfa-5bcf30f6e214" 
    /dev/sda8: LABEL="/boot" UUID="3ba53f9b-f44b-4c3f-aaa2-0dfbbb75b1e5" TYPE="ext4" PARTUUID="ba3e3a96-a991-401b-a09e-730270d879eb" 
    /dev/sda9: LABEL="/home" UUID="20ad6689-b5a3-4ec3-a9f4-e81d6360ca58" TYPE="ext4" PARTUUID="70ae19be-b309-4939-b236-039acc53718e" 
    /dev/sda10: LABEL="/" UUID="6da5e19a-e9e8-4ad0-a04f-aeaca04035a2" TYPE="ext4" PARTUUID="44f32e05-158d-4535-a5db-40f1b0ded7ca" 
    /dev/sda11: LABEL="swap" UUID="d080a09a-3b45-48d7-9410-ba3b07443388" TYPE="swap" PARTUUID="a61f716e-e187-4f7c-afb9-a44c28cb235f" 
    /dev/sda12: PARTUUID="dc82d2c4-3f74-4b25-9f00-bfb340de03f4" 
    
    
    For more information refer man page:
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How to list UUID, FSTYPE , LABEL of storage devices in a llinux system ?
Your information: