From: mooney@dogbert.cc.ndsu.NoDak.edu (Tim Mooney)
Subject: Re: du command on AdvFS
Date: 31 Jan 2002 20:30:50 GMT [thread overview]
Message-ID: <a3c9hq$bep$1@news.ndsu.nodak.edu> (raw)
In-Reply-To: 110fcff.0201281702.7e624109@posting.google.com
In article <110fcff.0201281702.7e624109@posting.google.com>,
Priscilla <pdioquino@yahoo.com> wrote:
> I'm trying to find out why the du -sk command is sometimes reporting
> the wrong disk usage on my directories. In my latest trial, I drilled down
> and found specifically one file that was way off that was causing the whole
> directory report to be off.
>
> /archive> du -sk smith.cf
> 100992 smith.cf
>
> /archive> ls -l smith.cf
> -rw-rw-r-- 1 prod tspi 372203552 Jan 24 11:03 smith.cf
It's likely a sparse file. du -ks is showing you the actual amount of
space the file is using, while ls is showing you how much space it would
be using if there weren't big gaps in it. du is showing you how much
Swiss cheese you actually have (when you account for the holes), while ls
is just showing you a big block of cheese, without telling you there are
big sections that don't contain any cheese.
Note that AdvFS quota files are sparse files (assuming you don't have
completely consecutive numeric ids), so you'll see this same behavior there.
> I tar'd the whole directory over to another fileset and now the file
> size (and directory usage) are correctly reported.
:-) And now you have a file that's no longer sparse, so ls and du can
agree. Of course, it's possibly wrecked the file (especially if the file
was some type of database file), so you may be worse off than you were before.
When you're going to move or archive sparse files, be sure you use a tool
that correctly handles sparse files. The traditional UNIX backup tools
(dump or ufsdump, and vdump for AdvFS) correctly handle sparse files. The
traditional UNIX archive tools (tar, cpio, pax) generally do *not*.
GNU tar has an option, `--sparse', that you can pass it, and it will correctly
handle sparse files (the option may not even be needed anymore, it may handle
them automatically, but old habits die hard so I still supply that option).
Tim
--
Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
prev parent reply other threads:[~2002-01-31 20:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-29 1:02 du command on AdvFS Priscilla
2002-01-29 8:57 ` Joerg Bruehe
2002-01-29 10:13 ` Marre du Spam dans les news
2002-01-29 11:54 ` Quarter Horseman
2002-01-29 19:07 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
2002-01-30 11:41 ` Quarter Horseman
2002-01-31 20:30 ` Tim Mooney [this message]
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