From: Bob Harris <harris@zk3.dec.com>
Subject: Re: How is this possible?
Date: Sun, 08 Feb 2004 04:11:01 GMT [thread overview]
Message-ID: <harris-09D710.23110107022004@cacnews.cac.cpqcorp.net> (raw)
In-Reply-To: bvo7lk$pmf$1@planja.arnes.si
In article <bvo7lk$pmf$1@planja.arnes.si>,
Zlatko Rek <no.name@spam.com> wrote:
> The disk is 20GB and the file is 620GB!
>
> $ ls -l
> total 157425
> -rw-r--r-- 1 xxxxx users 7 Oct 29 2001 INPUT
> -rw-r--r-- 1 xxxxx users 4084328 Feb 2 17:25 kc.bc_20000
> -rw-r--r-- 1 xxxxx users 4084328 Jan 29 15:18 kc.bc_5000
> -rw-r--r-- 1 xxxxx users 188608 Oct 29 2001 kc.bnd
> lrwxr-xr-x 1 xxxxx users 8 Feb 3 10:16 kc.flo -> kc.flo-2
> -rw-r--r-- 1 xxxxx users 67109040 Jan 30 13:36 kc.flo-1
> -rw-r--r-- 1 xxxxx users 665904666240 Feb 2 17:25 kc.flo-2
> ^^^^^^^^^^^^
> $ df
> Filesystem 1024-blocks Used Available Capacity Mounted on
> home_domain#home 21912264 17068577 4834752 78% /home
> ^^^^^^^^
> $ uname -mr
> V5.1 alpha
>
As has been mentioned in a previous reply, the file is most likely
sparse. Since this is an AdvFS file system you can do 2 things to see
the sparseness.
ls -s
Will tell you the amount of storage actually allocated to the file vs
the location of the last byte of the file.
/usr/sbin/showfile -x
will show you the extent information for the file telling you what
storage has been allocated. There are man pages that describe both of
these commands and options.
There is no way to make the file smaller without rewriting it from
scratch and eliminating the parts you don't want.
A typical cp/tar/cpio type command will only compound your problem
because these utilities will replace sparse holes with real storage.
There vdump/vrestore commands are suppose to know how to read the sparse
map and copy a file without filling in the holes. Check the examples in
the man pages, but something like this might work for copying such a
file:
vdump -0f - kc.flo-2 | vrestore -xf - -D /destination/directory/
Never tried it, so I'm not sure it will do what I suggest.
The dd command also has a sparse option that attempts to avoid writing
blocks of zeros in a file it is copying.
dd if kc.flo-2 of /target/directory/kc.flo-2 conv=sparse
However, dd will read every virtual byte of the file and compare it for
zeros. 620GB of reading holes and comparing it against zeros will
consume huge amounts of CPU time. It would be best to use
vdump/vrestore as a copy tool as it will read the extent map and just
read the parts of the file that exist.
Of course there is the very rude and crude approach of writing a program
to read the showfile -x output and only copy the parts of the file that
have storage. of course if you are going to do this, you might as well
just use the fcntl( F_GETMAP ) system call and have AdvFS tell you what
parts of the file are sparse in the first place (also works for sparse
UFS files)
Now if your goal was to transfer the file to a different systems that is
not NFS connected or you want to compress it first, then you might be
able to combine a compression, tar, untar, uncompress, dd sequence, and
vrestore was not an option on the target system, then you might try
gzip kc.flo-2
tar cf kc.flo-2.tar kc.flo-2.gz
on the other end
tar xf kc.flo-2.tar
gunzip -c kc.flo-2.gz | dd of kc.flo-2 conv=sparse
You might have to do the compression first because tar does not really
like huge files. Compressing it first may keep the real size to
something tar can swallow.
I hope this helps.
Bob Harris
prev parent reply other threads:[~2004-02-08 4:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-03 13:28 How is this possible? Zlatko Rek
2004-02-03 15:11 ` Peter da Silva
2004-02-04 7:10 ` Zlatko Rek
2004-02-04 18:57 ` Peter da Silva
2004-02-08 4:11 ` Bob Harris [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