Sample Header Ad - 728x90

Understanding iostat block measurements

1 vote
1 answer
2433 views
I am trying to understand how data is written to the disk. I'm writing data with dd using various block sizes, but it looks like the disk is always getting hit with the same size blocks, according to iostat. For example this command should write 128K blocks. dd if=/dev/zero of=/dev/sdb bs=128K count=300000 Trimmed output of iostat -dxm 1: Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sdb 0.00 129897.00 0.00 1024.00 0.00 512.00 1024.00 142.09 138.81 0.00 138.81 0.98 100.00 My reading of this is that it's writing 512MBps in 1024 operations. This means each write = 512/1024 = 512K. Another way of calculating the same thing: The avgrq-sz column shows 1024 sectors. According to gdisk the sector size of this Samsung 850 Pro SSD is 512B, therefore each write is 1024 sectors * 512B = 512K. So my question is, why is it writing 512K blocks instead of 128K as specified with dd? If I change dd to write 4M blocks, the iostat result is exactly the same. The merges number doesn't make sense to me either. That was writing directly to the block device; but if I format it XFS and write to the filesystem, the numbers are the same except zero merges: dd if=/dev/zero of=/mnt/ddtest bs=4M count=3000 Now iostat shows Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sdb 0.00 0.00 0.00 1024.00 0.00 512.00 1024.00 142.31 138.92 0.00 138.92 0.98 100.00 I'm using RHEL 7.7 by the way.
Asked by Elliott B (575 rep)
Sep 10, 2019, 08:38 AM
Last activity: May 14, 2025, 01:11 AM