Print

Print


If you don't have /dev/urandom, and you aren't worried about disclosing 
whatever may be on your drive:

dd if=/dev/ad0 of=bigtestfile bs=64k count=15912

where /dev/ad0 is your hard drive (I use FreeBSD, so translate accordingly). 
If that bothers you, read the input data from an unencrypted DVD. 

You can try other values for bs and count (e.g. bs=512k count=1989), but my 
experience is that block sizes around 32k or 64k usually give optimum 
transfer rates on my system.

- Bob



On Monday 06 August 2007 08:51, Allen S. Rout wrote:
> So, for debugging purposes (long story) I want to create a couple of
> files which are precisely
>
> 1042808832
>
> bytes long.  We were musing about optimal ways to do this.  I finally
> punted and wrote code:
>
> perl -e
>  ' for ( $i=shift; $i>=0; $i-= 1024 ) {read(STDIN,$b,$i<1024?$i:1024);
> print STDOUT $b } ' 1042808832
>
> note the conceit that I'm pretending to block it. :P
>
> mkfile does not seem to permit the submission of some input stream, so
> you get a file full of zeros.
>
> Of course, doing this with /dev/random takes a while. :)
>
>
> So, how would you-all solve that one?  I have this intuition that
> there's a simpler way I just can't find.
>
>
> - Allen S. Rout