create a large file
Make a file of a given size, for testing disks, uploads or swap.
danger Steps marked in red delete, overwrite or stop something. Read each one before you run it.
Steps
-
fallocate -l 1G big.img1 GB at once, reserved on the disk (Linux)
-
truncate -s 1G sparse.imgdanger 1 GB that takes no room until written
-
dd if=/dev/zero of=big.img bs=1M count=1024 status=progressdanger 1 GB of zeros, written out
-
head -c 100M /dev/urandom > random.bin100 MB of random bytes
Commands used
fallocatetruncatedd
Each has a page in lore: lore fallocate opens it.
Related recipes
- disk full but df says there is room"No space left on device" with free gigabytes: the disk is out of inodes, the slots for files. Find the folder with too many small files.
- find big filesFind the files that take the most room, on a whole disk or in a folder.
- free disk spaceFind what fills a disk, then clear what is safe to clear: old package files, logs, caches.
- see the size of files and foldersHow much room each file and folder takes, here or anywhere, biggest last.