Create a large file in Linux for testing

There are many ways to go about this.  A common favorite is the use of the dd command. This simple two letter command requires so many parameters to accomplish the simple goal of generating a file of a specific size. There is another way, and it’s easier to remember too.

Create a 100MB file using dd will look something like this.

dd if=/dev/zero of=test.img bs=1024 count=0 seek=$[1024*100]

To accomplish the same effect, try fallocate.

fallocate -l 100M test.img

From the man fallocate pages, the -l is the length and may be expressed in k, m, g, t, p, e to denote KB, MB, GB, etc.

As it turns out, the minimal install of CentOS6 Linux had this neat little utility already installed.

Source(s)
https://www.cyberciti.biz/faq/howto-create-lage-files-with-dd-command/