tech-misc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: du -m is off
On Sat, Mar 22, 2008 at 01:10:04PM -0400, Greg A. Woods; Planix, Inc. wrote:
>
> Now as to the problem with your 10485760-byte file, well that's easy
> to understand if you first take a peek at just how much space has
> been allocated for that file (and keep in mind that "du" shows disk
> usage, not file size) [use "stat -s"]. For example when I create an
> exactly 10MB file I get a file that uses 20512 "blocks" (i.e. 512-
> byte-blocks) of disk space. If you multiply that back out then the
> bytes of disk space used are 10502144, i.e. 10.015625MB, and so by
> the logic above that means that in 1MB units the file does indeed use
> what must be counted as 11MB of disk space. This is of course
> because the block size on the filesystem is 16KB, not 512B, and your
> 10MB file actually needs 623 filesystem(16KB) units of allocation,
> i.e. it does actually use more than 10MB of filesystem space.
The output of 'du' includes the indirect blocks, so will be larger
than the filesize for non-trivial files without holes.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index