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?

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?

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?

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.

thanx for all this information.........
:b: