What does 'IO Block' mean in the out put of stat command
Filesystem: ext4
I find a fun phenomenal when I run stat command on different file systems: stat output on local disk: # stat test File: `test' Size: 0 Blocks: 0 IO Block: 4096 regular empty file stat output on nfs disk: # stat test File: `test' Size: 0 Blocks: 0 IO Block: 1048576 regular empty file My question is why IO Block is different? and what does IO Block mean? Thanks in advance. |
I believe the IO block size of an NFS disk is "not really specified" (I think you are seeing an uninitialized value). NFS can't use a block size, as it is limited by the network. Any block size specifications are only on the server, but that information isn't passed to the client, as there is no way for the client to make use of it.
|
A block is the minimal size that can be written to disk. Even if the size is smaller then this block, a full block is needed.
On modern Linux systems the block size is 4096 (but it can be smaller/larger). The block size is set/determined when creating a file system, you can retrieve it by using the following command (as root): Code:
# dumpe2fs /dev/sda2 | grep "^Block size:" When using NFS you can set the rsize and wsize while mounting; The 1048576 seen on the NFS share is the largest read/write payload supported by the Linux NFS client. |
Hi All,
Thanks for your effort. But I want to know what exactly 'IO Block' mean in stat command and the value of 'IO Block' in nfs is quite different, so what resulted in this? Thanks |
Quote:
IO Block is a fixed thing, it shows the block size that is being used. 4096 on the ext4 files-system you use, 1048576 on the NFS file-system you use. The stat line: Size: shows the actual size (what you expect: a 1 byte file will show up as 1). Blocks: Is the amount of blocks used (a 1 byte file will use 1 block, which is 4096 bytes on disk for a normal file-system). IO Block: Size of the block used. |
Quote:
I mean the value of 'IO Block' in nfs directory is not always 1048576. It could be any other value, like 4096, 32768 etc after checking some other nfs. I want to know what decides this value? Thanks |
Quote:
This from the nfs manual page: Quote:
Quote:
|
Quote:
This is a instance of my environment. NFS mount options: type nfs (rw,hard,intr,bg,rsize=32768,wsize=32768,addr=187.25.22.171) stat output of nfs directory File: `etc/' Size: 20480 Blocks: 40 IO Block: 4096 directory Device: 19h/25d Inode: 44446164 Links: 95 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) It seems is not desided by rsize and wsize. |
Quote:
|
Quote:
we back up /etc to a nfs mount. ip:/backup is mounted to /var/backup etc is backed up to /var/backup/etc, and I run stat on /var/backup/etc Thanks. |
All times are GMT -5. The time now is 02:17 PM. |