Hacker News new | past | comments | ask | show | jobs | submit
If I recall correctly:

    dd if=/dev/urandom of=/home/myrandomfile bs=1 count=N
I just use fallocate to create a 1GB or 2GB file, depending on the total storage size. It has saved me twice now. I had a nasty issue with a docker container log quickly filling up the 1GB space before I could even identify the problem, causing the shell to break down and commands to fail. After that, I started creating a 2GB file.
loading story #47689746
Fwiw you can also do this with

    head -c 1G /dev/urandom > /home/myrandomfile
And not have to remember dd's bizarre snowflake command syntax.
If you want to do it really quickly

    openssl enc -aes-256-ctr -pbkdf2 -pass pass:"$(date '+%s')" < /dev/zero | dd of=/home/myrandomfile bs=1M count=1024
Almost all CPUs have AES native instructions so you'll be able to produce pseudorandom junk really fast. Even my old system will produce it at about 3Gb/s. Much faster than urandom can go.
loading story #47679328
My choice has always been `shred`:

  $ sudo truncate --size 1G /emergency-space
  $ sudo shred /emergency-space

I find it widely available, even in tiny distros.
bs=1 is a recipe for waiting far longer than you have to because of the overhead of the system calls. Better bs=N count=1
loading story #47678146
loading story #47678106