mkfile -n size[b|k|m|g] filenameUsing the above, to create a 2GB file called “TESTFILE” on the desktop, use the following command:
mkfile -n 2g ~/Desktop/TESTFILEThe file is created instantly and occupies the desired space on the disk. If you cat the file you should see a whole lot of zeros. I use dd for testing throughput (e.g. to large storage arrays) as there are more options, but mkfile is a useful tool as well. When you use Disk Utility to generate files, you’re basically just piping to mkfile, so this gives you a programmatic way to do so from the command line. Enjoy.
krypted March 17th, 2016
Posted In: Mac OS X