* How is this possible?
@ 2004-02-03 13:28 Zlatko Rek
2004-02-03 15:11 ` Peter da Silva
2004-02-08 4:11 ` Bob Harris
0 siblings, 2 replies; 5+ messages in thread
From: Zlatko Rek @ 2004-02-03 13:28 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How is this possible?
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-08 4:11 ` Bob Harris
1 sibling, 1 reply; 5+ messages in thread
From: Peter da Silva @ 2004-02-03 15:11 UTC (permalink / raw)
In article <bvo7lk$pmf$1@planja.arnes.si>,
Zlatko Rek <no.name@spam.com> wrote:
> The disk is 20GB and the file is 620GB!
In UNIX file access is performed one of two ways, through memory
mapping or through stream I/O, both of which can produce this result
albeit through different operations.
If the file was memory mapped but unallocated and a program wrote to a
block near the end of the mapped region, or if the file was a stream
and the program performed a very large seek operation and then wrote
some data, the result would be what's called a "sparse file": a file
that is logically thousands or (in this case) millions of virtual
"null" blocks that aren't actually allocated from the pool of free
blocks on disk, with a handful of actual data blocks where writes have
actually occurred.
--
I've seen things you people can't imagine. Chimneysweeps on fire over the roofs
of London. I've watched kite-strings glitter in the sun at Hyde Park Gate. All
these things will be lost in time, like chalk-paintings in the rain. `-_-'
Time for your nap. | Peter da Silva | Har du kramat din varg, idag? 'U`
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How is this possible?
2004-02-03 15:11 ` Peter da Silva
@ 2004-02-04 7:10 ` Zlatko Rek
2004-02-04 18:57 ` Peter da Silva
0 siblings, 1 reply; 5+ messages in thread
From: Zlatko Rek @ 2004-02-04 7:10 UTC (permalink / raw)
Peter da Silva wrote:
> In UNIX file access is ...
Peter, thank you for your explanation.
Onother question: How to fix this "problem"?
cp/tar didn't work.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How is this possible?
2004-02-04 7:10 ` Zlatko Rek
@ 2004-02-04 18:57 ` Peter da Silva
0 siblings, 0 replies; 5+ messages in thread
From: Peter da Silva @ 2004-02-04 18:57 UTC (permalink / raw)
In article <bvq5tg$n9q$1@planja.arnes.si>,
Zlatko Rek <no.name@spam.com> wrote:
> Onother question: How to fix this "problem"?
> cp/tar didn't work.
I didn't see a problem that needed to be fixed. I assume, though, that
what you really meant to ask was "how do I copy this without filling
the disk"? About 20 years ago when I first ran into this problem on
Xenix I wrote a program that worked like "cpio -p" that I called
"copyto" that took care of this problem as well as recovering as much
as was possible from files containing bad blocks (back then disks
weren't quite so reliable as they are now).
Now, however, you can do better... gnu tar* has an option (-S) for
handling sparse files efficiently.
* http://www.gnu.org/software/tar
--
I've seen things you people can't imagine. Chimneysweeps on fire over the roofs
of London. I've watched kite-strings glitter in the sun at Hyde Park Gate. All
these things will be lost in time, like chalk-paintings in the rain. `-_-'
Time for your nap. | Peter da Silva | Har du kramat din varg, idag? 'U`
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How is this possible?
2004-02-03 13:28 How is this possible? Zlatko Rek
2004-02-03 15:11 ` Peter da Silva
@ 2004-02-08 4:11 ` Bob Harris
1 sibling, 0 replies; 5+ messages in thread
From: Bob Harris @ 2004-02-08 4:11 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-02-08 4:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox