Skip to content

Instantly share code, notes, and snippets.

@vejandla
Last active March 9, 2021 16:59
Show Gist options
  • Save vejandla/dedb172a33d7168df492adc4dca52d8a to your computer and use it in GitHub Desktop.
Save vejandla/dedb172a33d7168df492adc4dca52d8a to your computer and use it in GitHub Desktop.
How to create large test files in no time

On Linux

dd is the command from Linux. To create 1 GB file go with dd if=/dev/zero of=testfile bs=1024 count=1024000

to create 100 MB try dd if=/dev/zero of=testfile bs=1024 count=102400

and for 10 MB use dd if=/dev/zero of=testfile bs=1024 count=10240

You can find on other forum that they use /dev/urandom or /dev/random however this are load intensive for your server and take longer to make the file.

On MAC OS

mkfile -n size[b|k|m|g] filename

This creates a 500 mb file mkfile -n 500m ~/Desktop/LargeTestFile500mb.pdf

more details

On Windows

For example, this command will create a 1GB file called 1gb.test on my desktop:

fsutil file createnew c:\users\vejandla\desktop\1gb.test 1073741824

The key is to input the size of the file in bytes, so here are some common file sizes to save you from math:

1 MB = 1048576 bytes

100 MB = 104857600 bytes

1 GB = 1073741824 bytes

10 GB = 10737418240 bytes

100 GB =107374182400 bytes

1 TB = 1099511627776 bytes

10 TB = 10995116277760 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment