ext3/ext4 physical block size view
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
$ 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.)