create a large file

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

filesdisks

danger Steps marked danger 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

fallocatetruncatedd

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