Determining Block Sizes in CentOS 5 & 6

Been a looooong time, but I felt this was worthy of continuing to build up my tips and tools library/blog with some block searching info since I ran into this today @ work.

lsblk is only available on CentOS 6+ to my best knowledge, so on CentOS 5, we’d want to run the following:

[root@deadbeef ~]# tune2fs -l /dev/disk/block/fun | grep 'Block' | tr -s ' ' | cut -f3 -d' '

471859163
4096
group:

So the first number is the amount of blocks and the second is the block size here.  Multiply them together to get your answer in bytes. The word group: is just an anomaly of the filtering and can be ignored.

In CentOS 6, we can leverage lsblk:

lsblk -o NAME,PHY-SeC

Output:
NAME   PHY-SEC 
sda        512 
├─sda1     512 
├─sda2     512 
└─sda5     512 

Advertisements