Linux Commands to Create Large Empty Files

Mindwatering Incorporated

Author: Tripp W Black

Created: 07/12/2023 at 02:33 PM

 

Category:
Linux
Utilities

The fallocate command creates uninitialized files. Very quick because it doesn't spend the extra time to add a bunch of 0s w/in the file.

$ fallocate -l 10G /home/myadmin/10GigFile.txt

Notes:
The -l is for length, so it is a lowercase L
Use abbreviations M,G,T, etc.


A little longer - actually writes the files instead of a pre-allocation:
$ dd if=/dev/urandom of=random.img count=1024 bs=10M


$ xfs_mkfile 8g /home/myadmin/10GifFile.txt




previous page

×