LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2013, 03:36 AM   #1
hilou
Member
 
Registered: May 2013
Posts: 93

Rep: Reputation: Disabled
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.
 
Old 11-07-2013, 04:46 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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.
 
Old 11-07-2013, 04:47 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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:"
Replace the bold part with the device you want to check.

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.
 
Old 11-07-2013, 08:20 AM   #4
hilou
Member
 
Registered: May 2013
Posts: 93

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-07-2013, 08:34 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by hilou View Post
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?
I'm not sure what more I can tell you.

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.
 
Old 11-11-2013, 01:02 AM   #6
hilou
Member
 
Registered: May 2013
Posts: 93

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
I'm not sure what more I can tell you.

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.
Hi,

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
 
Old 11-11-2013, 02:18 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by hilou View Post
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?
As mentioned in post #3: The rsize/wsize option.

This from the nfs manual page:
Quote:
The rsize value is a positive integral multiple of 1024.
Specified rsize values lower than 1024 are replaced with
4096; values larger than 1048576 are replaced with
1048576. If a specified value is within the supported
range but not a multiple of 1024, it is rounded down to
the nearest multiple of 1024.
The following quote is from Optimizing NFS Performance
Quote:
5.1. Setting Block Size to Optimize Transfer Speeds

The mount command options rsize and wsize specify the size of the chunks of data that the client and server pass back and forth to each other. If no rsize and wsize options are specified, the default varies by which version of NFS we are using. The most common default is 4K (4096 bytes), although for TCP-based mounts in 2.2 kernels, and for all mounts beginning with 2.4 kernels, the server specifies the default block size.
 
Old 11-14-2013, 01:06 AM   #8
hilou
Member
 
Registered: May 2013
Posts: 93

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
As mentioned in post #3: The rsize/wsize option.

This from the nfs manual page:

The following quote is from Optimizing NFS Performance
Hi,

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.
 
Old 11-14-2013, 03:41 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by hilou View Post
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.
Just to make sure: Your /etc directory is an nfs mount? Or is this another directory called etc in a different location?
 
Old 11-18-2013, 08:25 PM   #10
hilou
Member
 
Registered: May 2013
Posts: 93

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
Just to make sure: Your /etc directory is an nfs mount? Or is this another directory called etc in a different location?
Hi,

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.

Last edited by hilou; 11-18-2013 at 08:27 PM.
 
  


Reply

Tags
file system



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
stat command on Solaris devUnix Solaris / OpenSolaris 7 03-18-2012 05:14 AM
[SOLVED] how to put ELSE for condition block of procmailrc recipes golden_boy615 Linux - General 2 05-02-2011 06:25 AM
date formatting from stat command tensigh Programming 10 08-30-2010 04:13 AM
stat command ravidangaych Linux - General 3 09-22-2009 05:02 AM
stat command joshnya Linux - Newbie 3 05-30-2008 04:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration