In this mode genfile creates a data file for the test
suite. The size of the file is given with the --length
(-l) option. By default the file contents is written to the
standard output, this can be changed using --file
(-f) command line option. Thus, the following two commands
are equivalent:
If --length is not given, genfile will
generate an empty (zero-length) file.
The default data pattern for filling the generated file consists
of first 256 letters of ASCII code, repeated enough times to fill the
entire file. This behavior can be changed with --pattern
option. This option takes a mandatory argument, specifying pattern
name to use. Currently two patterns are implemented:
--pattern=default
The default pattern as described above.
--pattern=zero
Fills the file with zeroes.
Special option --sparse (-s) instructs
genfile to create a sparse file. Sparse files consist of
data fragments, separated by holes or blocks of zeros. On
many operating systems, actual disk storage is not allocated for
holes, but they are counted in the length of the file. To create a
sparse file, genfile should know where to put data fragments,
and what data to use to fill them. So, when --sparse is given
the rest of the command line specifies a so-called file map.
The file map consists of any number of fragment
descriptors. Each descriptor is composed of two values: a number,
specifying fragment offset in the file, and contents string,
i.e. a string of characters, specifying the pattern to fill the
fragment with. File offset can be suffixed with the following
quantifiers:
‘k’
‘K’
The number is expressed in kilobytes.
‘m’
‘M’
The number is expressed in megabytes.
‘g’
‘G’
The number is expressed in gigabytes.
For each letter in contents string genfile will generate
a block of data, filled with this letter and will write it to
the fragment. The size of block is given by --block-size
option. It defaults to 512. Thus, if the string consists of n
characters, the resulting file fragment will contain
n*block-size of data.
Last fragment descriptor can have only file offset part. In this
case genfile will create a hole at the end of the file up to
the given offset.