FIle and Block size relationships ...
Mike Reinehr
cmr
Tue Jun 6 16:45:09 PDT 2006
On Tuesday 06 June 2006 11:57 am, Ben Duncan wrote:
> Ok, I am busily writing my MVISAM package, when I noticed in some intense
> reading about the lINUX file system - file size / block size on files.
>
> I created a file with exactly 512 BYTES (It is my FILE header FWIW).
> I did a stat on it and it shows:
>
> bend at bns:mvisam -> stat test.dat
> File: `test.dat'
> Size: 512 Blocks: 8 IO Block: 4096 regular file
> Device: 821h/2081d Inode: 71290 Links: 1
> Access: (0755/-rwxr-xr-x) Uid: ( 500/ bend) Gid: ( 500/ appgen)
> Access: 2006-06-06 10:20:15.000000000 -0500
> Modify: 2006-06-06 08:46:23.000000000 -0500
> Change: 2006-06-06 08:46:23.000000000 -0500
>
> Does this mean that my FILE is really using 4096 BYTES of space
> and if I go over 4096 bytes, each "extension" will cost me
> 4096 byes (i.e 4100 byes file will really occupy 8192 bytes) ?
>
> I need to know, so I can tune my buffer/cache routines ..
> Or, if anyone has any suggestion on block size / cache
> I would appreciate it ...
>
> Thanks ..
Ben,
I'm afraid so. Here's an excerpt from man mke2fs:
> -b block-size
> Specify the size of blocks in bytes. Valid block size vales are 1024, 2048
> and 4096 bytes per block. If omitted, mke2fs block-size is heuristically
> determined by the file system size and the expected usage of the filesystem
> (see the -T option). If block-size is negative, then mke2fs will use
> heuristics to determine the appropriate block size, with the constraint that
> the block size will be at least block-size bytes. This is useful for certain
> hardware devices which require that the blocksize be a multiple of 2k.
You can use 'stat -f /dev/hd... ' to check your file system specifications.
Cheers!
cmr
--
Debian 'Sarge': Registered Linux User #241964
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC
More information about the Linux-users
mailing list