I am trying to calculate required IOPS for a fileserver, and to do this I need to know the typical block size. I know that NFS clients can use rsize and wsize to specify how much data is sent over the network. Does the NFS server also use these same values to write the data to the disk, or is there some other way to configure that? I haven't found anything in the man pages.


AIUI, it might use the same sizes if you switch the NFS export to sync mode. Otherwise, the comment by 炸鱼薯条德里克 is correct. It works like the underlying Linux filesystem, except that close() implies fsync().


So how does the underlying Linux filesystem work?

The writes go into the kernel page cache. This is a writeback cache. Because of this, multiple contiguous write requests can be merged into one.

The average size of writes the kernel sends to the disk device can be seen using the iostat command (i.e. on your NFS server).

  • I think this depends on the application. For example here it says that GNU cp uses 128K blocks, while on my CentOS system it uses 64K as shown in strace. eklitzke.org/efficient-file-copying-on-linux – Elliott B Sep 20 '19 at 21:47
  • Okay. Then how do you control the block size going from cache to disk? – Elliott B Sep 20 '19 at 22:28
  • @ElliottB So, obviously it's split on hardware limitations. You can also set a soft limit on requests in general, I guess this is mostly to limit induced latency. /sys/class/block/$DEVICE/queue/max_sectors_kb, except see unix.stackexchange.com/questions/529529/…. If there isn't any competing uncached/sync IO, I don't see that it would make a lot of difference, it would just make multiple requests in a row. IIRC it cycles between files with cached writes, and the amount written per file is some hard-coded value (16M?). – sourcejedi Sep 20 '19 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.