1

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.

1
  • Isn't that depending on your local filesystem Commented Sep 19, 2019 at 19:26

2 Answers 2

0

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().

http://nfs.sourceforge.net/nfs-howto/ar01s05.html#sync_versus_async

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).

4
  • 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 Commented Sep 20, 2019 at 21:47
  • Okay. Then how do you control the block size going from cache to disk? Commented Sep 20, 2019 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?). Commented Sep 20, 2019 at 22:40
  • "depends on the application" - no - the size of a single IO operation is fixed. The size of operations at different levels in the stack is variable. Commented Sep 7, 2023 at 13:10
0

Asked 4 years, 8 months ago

What size blocks does NFS server write to disk?

short answer : NFS server does not write to disk.

The answer is in the semantics...

NFS is the Network File System protocol. You can read up on that easily enough by doing a web search on it. Regarding rsize and wsize for NFS that has to do specifically with the maximum size of the RPC packet going over the network. It has nothing to do with writing to disk or more specifically writing into some file system on some physical storage that is presented to linux as a block device such as /dev/sdb1.

NFS current version as of year 2024 in NFS vers=4.2; everything defaults to proto=tcp and the default size for either rsize and wsize is the max at 1MB each {it shows up as 1,048,576 bytes}. And this is the 1MB packet size that happens over the network, all independent of writing to disk.

For writing to disk then first you have to know the file system, whether it is XFS or EXT3 or EXT4 to name a few.

https://man7.org/linux/man-pages/man8/mkfs.xfs.8.html

-b block_size_options Section Name: [block] This option specifies the fundamental block size of the filesystem. The valid block_size_option is:

              size=value
                     The filesystem block size is specified with a
                     value in bytes. The default value is 4096
                     bytes (4 KiB), the minimum is 512, and the
                     maximum is 65536 (64 KiB)

also look into https://stackoverflow.com/questions/51006070/file-system-block-size-vs-disk-block-size

And then there is also RAID stripe block size, if you are using RAID. Those choices can be any of 64kb, 128kb, 256kb, 512kb, 1MB.

So NFS data transfer and writing to disk are two independent things, and the details of writing to disk is a whole other topic.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.