[svlug] creating a big binary file

Holt Sorenson hso at nosneros.net
Thu Oct 11 22:57:59 PDT 2007


On Thu, Oct 11, 2007 at 10:43:53PM -0700, Anthony Ettinger wrote:
>It doesn't matter much to me, i just don't want the file to be able to
>be compressed at all.

If you don't want it to be compressed as it crosses the wire, or flows
through whatever software you're using, a 1GiB file from /dev/urandom
would be best because the entropy of the file is high enough that
it can't be compressed.

There's a small chance a compressed but regular file could be compressed
by different compression algorithm.

You can test what I'm asserting using the following:
dd if=/dev/urandom of=test1 bs=1048576 count=1
dd if=/dev/urandom of=test2 bs=1048756 count=1
dd if=/dev/urandom of=test3 bs=1048756 count=1
bzip2 -9 test2
gzip -9 test3
ls -l test*

To get your uncompressable 1GiB file, use the following:
dd bs=1048576 count=1000 if=/dev/urandom of=foo

You can substitute 1M for 1048576 if you have a dd that
understands "human" size suffixes, as pointed out by Marco.

-- 
Holt Sorenson
hso at nosneros.net
www.nosneros.net/hso




More information about the svlug mailing list