difference between mount point and physical drive?

Albrecht Dreß yellowdog-general@lists.terrasoftsolutions.com
Sun Oct 27 06:06:11 2002


Am 25.10.02 21:12:11 schrieb(en) Tim Seufert:
> The idea is simply to create a file occupying all the free space on the=
 
> target FS, filling it with 0 rather than the leftover random contents fro=
m 
> old file deletes.  Later on, gzip will get enormous compression ratios on=
 
> the long strings of zeroes this generates, dramatically reducing the size=
 
> of the partition image if there is much free space on the partition.

This is exactly the idea... Mathematically perfect random data is not 
compressible at all, a uniform block of zeroes (or any other value) can be 
compressed to almost zero (as you still need some info for decompression), 
and real lifa data is somewhere between.

To get a rough idea (as /dev/urandom is *not* perfect!), try to compress 1 
MByte from /dev/zero and /dev/urandom using gzip and bzip2:

----snip here and type or copy/paste into your terminal----------
for p in gzip bzip2 ; do
for n in zero urandom ; do
echo -en "1048576 bytes from $n w/ $p -> \t"
dd if=/dev/$n bs=1M count=1 2> /dev/null | $p -9 | wc --bytes |\
awk '{printf "%7d (%7.3f%%)\n", $1, (100.0*$1)/(1024.0*1024.0)}'
done
done
----snip complete------------------------------------------------

which (on my box) gives the result:

1048576 bytes from zero w/ gzip ->         1051 (  0.100%)
1048576 bytes from urandom w/ gzip ->   1048754 (100.017%)
1048576 bytes from zero w/ bzip2 ->          45 (  0.004%)
1048576 bytes from urandom w/ bzip2 ->  1053654 (100.484%)

So, 1 MB zeros gzips to ~1k, whereas the compressed random block is even 
*bigger* than uncompressed!

Cheers, Albrecht.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Albrecht Dreß  -  Johanna-Kirchner-Straße 13  -  D-53123 Bonn (Germany)
        Phone (+49) 228 6199571  -  mailto:albrecht.dress@arcor.de
_________________________________________________________________________