The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to stat X-Server on AIX 5.3 ??? touny AIX 5 11-20-2007 07:29 AM
Hi errno in sys/stat.h vijlak High Level Programming 6 11-11-2006 09:13 PM
Cannot Stat Error Homer Allman UNIX for Advanced & Expert Users 1 05-22-2006 10:07 AM
Cannot stat? lgardner UNIX for Dummies Questions & Answers 1 05-27-2005 04:05 PM
stat() fails!!! what can i do? solvman High Level Programming 3 02-06-2002 05:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-07-2008
gajju gajju is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 7
stat

the output of stat command is
Size: 238 Blocks: 8 IO Block: 4096 regular file
Device: 80ah/2058d Inode: 736783 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ gajju) Gid: ( 500/ gajju)
Access: 2008-09-08 20:00:15.000000000 +0530
Modify: 2008-09-08 20:01:42.000000000 +0530
Change: 2008-09-08 20:01:42.000000000 +0530


wat is the significance of BLOCKS and IO BLOCK here?
  #2 (permalink)  
Old 09-07-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
BLOCKS tells you that, when measured in standard 512 byte blocks, 8 blocks have been allocated for this file. IO BLOCK 4096 tells you that i/o to the file will happen in 4096 byte blocks at a time. Putting it all together... the filesystem allocates 4096 byte blocks at a time to a file. Your file is using 1 such block.
  #3 (permalink)  
Old 09-07-2008
gajju gajju is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 7
stat

Quote:
Originally Posted by Perderabo View Post
BLOCKS tells you that, when measured in standard 512 byte blocks, 8 blocks have been allocated for this file. IO BLOCK 4096 tells you that i/o to the file will happen in 4096 byte blocks at a time. Putting it all together... the filesystem allocates 4096 byte blocks at a time to a file. Your file is using 1 such block.
it means that if i increase in data of file,then it would occupy 16 blocks on disk
even if size of file is less than 16 block but greater than 8 blocks?
and why do we need block for allocation?
  #4 (permalink)  
Old 09-08-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Once you fully use the first 4096 block, yes you will get a 2nd. The filesystem works in blocks for efficiency. Metadata is needed to remember which block is assigned to which file. If the block size was 1 byte, more than half of the filesystem would be needed for meta-data. Also writing one byte at a time would take too long. So it reads and writes data in large blocks and buffers it to reduce the amount of physical I/O.
  #5 (permalink)  
Old 09-08-2008
gajju gajju is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 7
Quote:
Originally Posted by Perderabo View Post
Once you fully use the first 4096 block, yes you will get a 2nd. The filesystem works in blocks for efficiency. Metadata is needed to remember which block is assigned to which file. If the block size was 1 byte, more than half of the filesystem would be needed for meta-data. Also writing one byte at a time would take too long. So it reads and writes data in large blocks and buffers it to reduce the amount of physical I/O.
thanx for this information......
but i would like to know one more thing that why do we need 2 kind of blocks
one block of size 512 bytes & another if I/o BLOCK of 4096 bytes.
wat is the use of first kind of block?
  #6 (permalink)  
Old 09-08-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
The 512 is only to report the size in a standard format. When you see that a file is using 8 blocks, that means the same thing on all versions of unix. 512 was chosen because some old versions of unix really used a blocksize of 512.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0