du confusion
Russell Coker
russell at coker.com.au
Thu Feb 23 21:44:50 UTC 2006
On Friday 24 February 2006 05:35, Valdis.Kletnieks at vt.edu wrote:
> On Thu, 23 Feb 2006 14:40:39 GMT, Joe Orton said:
> > That would be really evil, du is *supposed* to report disk usage not
> > file sizes. It's always been true that disk usage and file size can
> > diverge, that's why du and ls are separate tools.
Actually if we added a couple of new options to ls then du could be an alias
to ls.
> 'du' doesn't report on the space used by the inode either - and on many
> filesystems with many small files, the inode is a significant chunk of
> the used space....
On most file systems the Inodes are in a table of fixed size which makes them
less relevant. However du also doesn't report directory space used on a
per-file basis so a file with a long name is regarded as taking no more space
than a file with a short name. du on a directory gives the total space used
by all files and directories below it.
On Friday 24 February 2006 06:01, Joe Orton <jorton at redhat.com> wrote:
> You're forgetting about sparse files, I think.
Correct. This doesn't mean we can't solve this SE Linux related issue, just
that we need to solve it in a different way.
What if we add a new option to du to use the minimum of the apparent size and
the reported number of blocks used. If a sparse file on SE Linux has one
sparse block then both numbers will be the same. For non-sparse files du
would report the size minus the size of xattrs. For sparse files that have
more than one sparse block then du would report the space used which includes
the xattrs (IE the same thing it does now by default).
Thanks for all the comments. If my latest idea is regarded as worthy then
I'll write the patch for coreutils.
--
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/ Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/ My home page
More information about the fedora-selinux-list
mailing list