How to generate test files

by Per Hansen

When testing file transfers it is sometimes useful to have some generic test files of a specific size on your system, which does not contain any confidential data. This article shows you how to generate these kinds of files.

An easy way to generate test files is to use a program calleddd. This simply writes a file consisting of a lot of zeros to the location you specify. You can specify various parameters, such as the size of the file.

installing dd

is available for Windows, Linux, Unix and OS X. If you have Linux, a Unix system or OS X, should already be installed. To check, open up a command prompt and type:

$ which dd

This should return the location of dd if it is in your$PATH.

dd for Windows:
Download for Windows from here:

Once you have downloaded the file, unzip it into a directory.

dd syntax
To use dd you must run it from a command line prompt. If you are using Windows, open a command prompt and navigate to the directory where you unzipped the file. You should find a program there called dd.exe, which is the one you need to run.

You will need to specify a few parameters in order to generate your test files. These are:

  • of=<file>: If you do not specify a path the test file will be written to the directory you are currently in.
  • bs=<block-size>: Normally set to 1024, i.e. 1KB.
  • count=<number>: Number of block size writes. Use of a multiple of 1024 keeps things in base-2

Windows examples:

Note: All Windows examples will assume placed intoc:\dd.

  • This writes a file called 10MB.testfile inc:\temp\testfiles, with a size of 10MB:

    c:> cd \dd c:\dd> dd if=/dev/zero of=C:/temp/testfiles/10MB.testfile bs=1024 count=12400
  • This writes a file called 1GB.testfile inc:\temp\testfile, with a size of 1GB:

    c:> cd \dd c:\dd> dd if=/dev/zero of=C:/temp/testfiles/1GB.testfile bs=1024 count=1024000

Linux examples:

  • This writes a file called 10MB in/tmp/10MB, with a size of 10MB:

    $ dd if=/dev/zero of=/tmp/10MB bs=1024 count=10240
  • This writes a file called 1GB in/tmp/1GB, with a size of 1GB:

    $ dd if=/dev/zero of=/tmp/1GB bs=1024 count=1024000


  • On Windows "/" are used in paths, not backslash "\"

  • On Windows please user lowercase when specifying the path and filename

  • If you are on Linux and doing this as root, don't forget to change the ownership of the files once you have generated them to the user you are using for transfer testing.

  • It may take a long time to generate large test files, so be patient.

  • An added benefit when doing this is that it will give you a rudimentary indication of your file system performance. It is not a file system performance test but it will tell you at what speed you can write a file of a certain size and give you a very rough indication.

Powered by Zendesk