[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: du -sh Error
From: |
Michael Stone |
Subject: |
Re: du -sh Error |
Date: |
Sat, 15 Jun 2002 15:23:34 -0400 |
User-agent: |
Mutt/1.2.5i |
On Sat, Jun 15, 2002 at 07:43:35PM +0200, Daniel Holbach wrote:
> address@hidden:/var/spool/oops/storages# du -sh
> 24k .
> address@hidden:/var/spool/oops/storages# ls -l
> -rw-r--r-- 1 proxy proxy 20971520 Jun 15 19:35 oops_storage
Probably a sparse file. For example:
(42)osgiliath:/tmp> dd if=/dev/zero bs=1048576 count=0 seek=20
of=sparsefile
0+0 records in
0+0 records out
(43)osgiliath:/tmp> ls -l sparsefile
-rw-rw-r-- 1 mstone mstone 20971520 Jun 15 15:17 sparsefile
(44)osgiliath:/tmp> du -sk sparsefile
0 sparsefile
(45)osgiliath:/tmp> ls -ls sparsefile
0 -rw-rw-r-- 1 mstone mstone 20971520 Jun 15 15:17 sparsefile
In unix it is possible to create a file with a given filesize but with
no data associated with it. In this case, no actual disk space is used
by the file. This is a mechanism commonly used by, e.g., databases and
core dumps--data can be stored at a particular location within a file,
not necessarily at the beginning, without wasting disk space. du
measures the disk blocks used by a file, while ls -l shows the logical
file size. You can also use ls -s to show the number of blocks allocated
to a file, or ls -ls to compare the number of blocks with the file size
(the number of blocks will be the first digit in the output.)
--
Mike Stone
- du -sh Error, Daniel Holbach, 2002/06/15
- Re: du -sh Error,
Michael Stone <=