1835592 Members
2513 Online
110079 Solutions
New Discussion

Re: I/O Block size

 
Rebecca Callan
Occasional Advisor

I/O Block size

I am writting an application to provide disk I/O stats. pstat reports all I/O stats in bytes and number of I/O's but my application has to be cross plateform and many other platforms report this info in blocks (as does sar -d). My problem is what block size to use to convert the bytes into blocks.

As far as I can see DEV_BSIZE (defined in sys/params.h) seems to be the most commonly used block size (on my system it is 1024). The df command reports in blocks. In the df man page is states that it reports in 512 byte blocks although (at least on my system) it seems to be reporting in 1024 byte blocks. (this is my DEV_BSIZE). The man page for sar (-d) states that is used 512 byte blocks (i don't know how to confirm whether it is actually is using that block size).I also found a BLKDEV_IOSIZE. The docs say "blocl devices are read in BLKDEV_IOSIZE units" (On my system it is 2048) this looks like what I want but I can't see any other applications using this block size.

I would like to know why we have these different block sizes and which is the most appropriate to use when reporting on disk I/O activity.
3 REPLIES 3
Andy Monks
Honored Contributor

Re: I/O Block size

basically it's upto the h/w driver.

That said, if your using lvm, it enforces a minumum blocksize of 1k.

Some of the drivers also see what's in there queue and merge multiple i/o's into 1 bigger I/O.

I think your going to have an uphill battle.

Glance (available for multiple platforms) does this, but it's got it's own hooks.
Jaimin Parikh
Frequent Advisor

Re: I/O Block size

Hi,

Another suggesstion.

You can use and getdiskbyname().

More information on below listed link.

http://www.docs.hp.com/cgi-bin/onlinedocs.py?mpn=B2355-90683&service=hpux&path=../B2355-90683/00/02/215&title=HP-UX%20Reference%20Volume%204%3A%20Section%203

This may be helpful to you.

Regards,
Jaimin Parikh
JAIMIN PARIKH : Share your knowledge and help those who need your help!!
Marcelo De Florio
Frequent Advisor

Re: I/O Block size

You can execute df -g for see the block size for each file system.

MDF