0

we have VM machine with disks as sdb sdc sdd ,,, etc

we create ext4 file system on sdb disk as the following

 mkfs.ext4  -j -m 0 /dev/sdb -F
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
262144 inodes, 1048576 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

now we want to check the filesystem type as the following

lsblk -o NAME,FSTYPE | grep sdb
sdb

but we should get the following expected results as

 lsblk -o NAME,FSTYPE | grep sdb
sdb              ext4

we not understand why after we create ext4 file system on our disks as sdb or sdc etc we not get the file-system type - ext4

1 Answer 1

8

lsblk uses UDev database to get information about filesystems so if it doesn't show the filesystem type, something is probably wrong with UDev. To check what UDev knows about the device, use udevadm info /dev/sdb and look for ID_FS_TYPE key.

It's also possible that UDev is just too slow on your device and the value is not yet updated in the database so lsblk prints the "old" value which is "no filesystem". You can try running udevadm settle before running lsblk.

Alternatively you can use sudo blkid -p /dev/sdb (or sudo blkid -p /dev/sdb -s TYPE -o value to print only the filesystem type value). blkid with -p option actually reads the metadata area of the device (that's why it needs sudo), so the information will always be correct/up to date.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.