From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.)
Subject: Re: abnormal file size
Date: 1995/05/17 [thread overview]
Message-ID: <3pduae$c8o@nntpd2.cxo.dec.com> (raw)
In-Reply-To: 3pd6fa$d73@news.uni-c.dk
In article <3pd6fa$d73@news.uni-c.dk>, franck@dtbsun (Marianne) writes:
> I hope somebody can help me with this. I have a file which looks like
>it's 3.3GB on a 1GB disk. 'ls -l' give 3.3GB and whenever I try to copy,
>backup, ftp the file it really come out as 3.3GB. The file is really 7MB
>and 'du -k' give the right size. I've tried to fsck the disk without
>success.
Sounds like a sparse file, which is perfectly acceptable and considered
by most, a feature. See the lseek(2) manual page for information about
how such a file is created. Some database libraries will create such
files; dbm(3) for example. The quota file is also such a file depending
on the range of the user ids. Core files created from system crash dumps
are also sparse files.
When lseek(2) can be used to move past the end of the file. When data
is written at the current offset, only the data for that offset is
allocated. Space for the intervening data isn't. When this hole is
read back it provides NULs.
Most programs that move files around simply read the NULs and fill
them in, which is why gets larger when you copy it. Dump/restore do
the appropriate thing, since dump can see that no blocks are allocated.
The dd(1) program has an option to convert NULs to appropriate holes;
conv=sparse.
>
>Thanks for any hint,
>Franck.
>
>
--
Alan Rollow alan@nabeth.cxo.dec.com
next prev parent reply other threads:[~1995-05-17 4:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-17 4:00 abnormal file size Marianne
1995-05-17 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. [this message]
1995-05-17 4:00 ` Michael W. Walker
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox