How to find filesystem block size in linux or Unix ?

Today we will look how to find a filesystem blocksize in Linux or Unix Operating System.

There are many ways, however the preferred ways are quoted below.

1. Use blockdev command.

[root@ngelinux ~]# blockdev --getbsz /dev/sdb2 
4096

 

2. Use of tune2fs command

[root@ngelinux ~]# tune2fs -l /dev/sdb2  | grep -i "block size"
Block size:               4096
[root@ngelinux ~]# 

 

Tip: Use filefrag command to verify if a particular file has same blocksize on the filesystem. See the blocksize in output.

[root@ngelinux ~]# filefrag -v /testext/testfile
Filesystem type is: ef53
Filesystem cylinder groups approximately 15
File size of /testext/testfile is 6 (1 block of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       0:       1024..      1024:      1:             merged,eof
/testext/testfile: 1 extent found, perfection would be -1 extent

Leave a Reply

avatar
  Subscribe  
Notify of