regarding blkid command

please help me to approve this assumption

can we say that blkid will print all disk devices only if these disks are with filesystem ( by mkfs )

/dev/sda1: UUID="cc749f07-ad00-49e8-ab19-eceef99f5e28" TYPE="xfs"
/dev/sda2: UUID="v0593a-KiKU-9emb-STbx-ByMz-S95k-jChr0m" TYPE="LVM2_member"
/dev/sdb: UUID="9b44be8e-fa59-4d84-ada5-1345498663ba" TYPE="ext4"
/dev/sdc: UUID="239505a3-8fb2-4da9-9edd-465299ce15c0" TYPE="ext4"
/dev/sde: UUID="986cd2f3-4d5d-4431-a221-30b142a61c7c" TYPE="ext4"
/dev/sdf: UUID="b8c3c3db-7e13-47b9-b4f9-f706a5223b76" TYPE="ext4"
/dev/sdd: UUID="3c3730ec-d23a-4d1b-8880-224eb658d3ab" TYPE="ext4"
/dev/mapper/vg00-lv_root: UUID="a8c48724-98b7-44b4-89ac-28214462638c" 
/dev/mapper/vg00-lv_swap: UUID="1beb675f-0b4c-4225-8455-e876cafc5756" 
/dev/mapper/vg00-lv_var: UUID="3de01172-29a2-4b5f-9aef-f9b3032eb7c5" TYPE="xfs"
  • 1
    almost duplicate of How to capture all disks that don’t have a file system – cas Jan 2 '18 at 7:32
  • Additionally to @cas: lsblk -a -f -l -o NAME,FSTYP gives you a list, where the second column is the fiesystem type, if any recognized. So you may look for devices without a filesystem. – ridgy Jan 2 '18 at 12:36
  • @ridgy read the answers and the comments in the linked post. Your suggestion has exactly the same problem as mentioned there. I pointed out several times in the comments and in my answer that lsblk does not recognise all valid block devices on linux so does not try to identify what filesystem might be on them blkid does a far better job (it works with all kinds of block devices that i'm aware of but as I was careful to point out, that is not an absolute guarantee). – cas Jan 2 '18 at 12:44
  • @cas , I am confuse , you say NO , so can you show me exactly the syntax command that will capture only the disks that with file system or after mkfs ? – jango Jan 2 '18 at 13:05
  • @cas even blkid is not reliable. E.g., two loop devices (loop0, loop1) both have three partitions, recognized by fdisk -l. But sudo blkid (even with -c /dev/null) only shows the partitions of loop0, though both devices are equivalent (use just a copy of the same file each). – ridgy Jan 2 '18 at 13:13


blkid lists all block devices (of all kinds - including HDD, SSD, USB drive, LVM member, ZFS ZVOL, etc), regardless of whether they have been formatted with a filesystem or not.

  • but how you explain that if I add new disk to machine blkid not recognize it , unless we do mkfs then it will appears on blkid – jango Jan 2 '18 at 8:22
  • maybe you not understand what we need , actually we need all disk that mkfs not run on them – jango Jan 2 '18 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.