On Wed, 28 Feb 2007, Nagaraj Yedathore wrote:
All,
I would like to know if there is way to get the number of blocks used to keep a
file of specified size in the UFS filesystem. The no. of blocks include the
actual size of the file with the likes of indirection blocks.
Thanks in advance,
Nagaraj.
Well:
The file itself has (filesize / fs_bsize) blocks.
An indirect block of fs_bsize holds fs_bsize/4 block addrs
A doubly indirect block of fs_bsize holds fs_bsize/4 direct block addrs
So you need:
(filesize / (fs_bsize^2/4)) indirect blocks
(filesize / (fs_bsize^3/16)) doubly indirect blocks
(filesize / (fs_bsize^4/64)^3) triply indirect blocks
If my math serves me right.
And the file is not sparse.
FrankH.
This message posted from opensolaris.org
_______________________________________________
ufs-discuss mailing list
[email protected]
_______________________________________________
ufs-discuss mailing list
[email protected]