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' '


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

sda        512 
├─sda1     512 
├─sda2     512 
└─sda5     512 


mkinitrd syntax error regarding conditional expression(s)

So working with an older CentOS 5.1 system today, I ran into a problem which I believed to be mkinitrd related when attempting to install kernel-PAE on a vmguest I upgraded to 4GB of vRAM.

I was seeing this upon yum installing kernel-PAE:

/sbin/mkinitrd: line 489: syntax error in conditional expression: unexpected token `('
/sbin/mkinitrd: line 489: syntax error near `^(d'
/sbin/mkinitrd: line 489: `        if [[ "$device" =~ ^(dm-|mapper/|mpath/) ]]; then'

So it turns out that bash was the problem here not mkinitrd.  I never thought that mkinitrd and bash would be so intertwined, but it makes perfect sense if you think about it.  I just never had to think about it ’til today.

I guess that serves us right for not keeping up with CentOS releases.  A big thanks to SmogMonkey for posting this find on