create a large file

Make a file of a given size, for testing disks, uploads or swap.

  • files
  • disks

danger Steps marked in red delete, overwrite or stop something. Read each one before you run it.

Steps

  1. fallocate -l 1G big.img

    1 GB at once, reserved on the disk (Linux)

  2. truncate -s 1G sparse.img

    danger 1 GB that takes no room until written

  3. dd if=/dev/zero of=big.img bs=1M count=1024 status=progress

    danger 1 GB of zeros, written out

  4. head -c 100M /dev/urandom > random.bin

    100 MB of random bytes

Commands used

  • fallocate
  • truncate
  • dd

Each has a page in lore: lore fallocate opens it.