ext3/ext4 physical block size view

Posted on

ext3/ext4 physical block size view – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, filesystems, linux-kernel, sles, .

I’m using a suse 11 server with xfs and using “xfs_info /srv” command i seen this.

xfs_info /srv/
meta-data=/dev/mapper/vg01-srvvol isize=256    agcount=38, agsize=1964032 blks
     =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=73367552, imaxpct=25
     =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=3836, version=2
     =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

So i think xfs knows the size of underline disk sectsz, but I’m using now a disk with sectsz of 512 bytes, but my question is, how can find this kind of information using ext3/ext4 filesystem?

Because i would like to try to use a new disk with sectsz of 4096 and be sure, ext3/ext4 uses the underline sectsz.

This is the output of xfs_info using one new ssd with physical block size 4096:

xfs_info /dev/mapper/vg00-logvol
meta-data=/dev/mapper/vg00-logvol isize=256    agcount=16, agsize=7144576 blks
         =                       sectsz=4096  attr=2, projid32bit=0
data     =                       bsize=4096   blocks=114313216, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=55817, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Solution :

$ sudo tune2fs -l /dev/vda1 
tune2fs 1.42.8 (20-Jun-2013)
Filesystem volume name:   <none>
Free inodes:              127696
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192

First, find the underlying dm device:

ls -l /dev/mapper/vg01-srvvol

Example output:

lrwxrwxrwx 1 root root 7 Jan 28 14:32 /dev/mapper/vg01-srvvol -> ../dm-0

Take the dm-0, dm-1, etc and see here:

cat /sys/block/dm-0/queue/physical_block_size

The only reliable way to determine the real physical block size is by querying the disk directly with hdparm:

hdparm -I /dev/sdX | grep Physical

All linux tools like parted, tune2fs, fdisk, also the kernel (via the value provided in /proc) output 512 Bytes for disks I have which are denoted 4K by hdparm. (5 HDDs tested, with two being 4K ones.)

Leave a Reply

Your email address will not be published.