DISKTEST(1)

NAME
disktest - Tool for testing disk devices

SYNOPSIS
disktest [-q] [-Q] [-r] [-w] [-E cmp_length ] [-a seed ] [ -A ] [-z|c|n|f fixed_pattern ] [-B sBLK[:eBLK] | -C cycles ] [-d ] [-D r%:w% ] [-F] [-h heartbeat ] [-K threads | -L seeks ] [-P TXPRA ] [ -m a ] [-N sectors ] [-s sLBA[:eLBA] ] [-S sBLK[:eBLK] ] [-T seconds ] [-p r | l [ u | d ] ] | L [ u | d ]] [-I [ d ] r | b | f [ s ] ] filespec

DESCRIPTION
Disktest does repeated accesses to a filespec and optionally writes to, reads from, and verifies the data. By default, disktest makes assumptions about the running environment which allows for a quick start of IO generation. However, Disktest has a large number of command line options which can be used to adapt the test for a variety of uses including data integrity, medium integrity, performance, and simple application simulation. Disktest will use the device specified by filespec. If no option is specified otherwise, disktest will attempt to determine filespec type. Fully qualified path must be give when filespec is not a normal file. This will help to determine it's type.

OPTIONS
Most options have multipliers that can be used to specify larger amounts. The following are a list of these multipliers.
    k = 1024, K = 10^3, m = 1024^2, M = 10^6
These can be used on options such as -B, -L, -N, -S, -s. The time options also have multipliers.
    m = 60, h = 60*60, d = 60*60*24
These can be used on options such as -h and -T.

-?  Displays a short description of the command line options and exits normally.

-a seed
    Use seed for all random number generation when constructing blocks of pseudo-random data and random seeks. By default, seed is set to the process id number. To reproduce a previous test run, use the process id number outputted to stdout.

-A  By default, when an access failure occurs all threads will die. If this option is specified, the threads will continue on.

-B sBlockSize[:eBlockSize]
    Set the size of the data block transfer. If only sBlockSize is specified, then the transfer length is always a fixed length of sBlockSize. If eBlockSize is specified, then the transfer length will be randomly chosen between sBlockSize and eBlockSize. The transfer size will always be a multipile of the sector size. If either parameter is greater then 256, then the value will be integer divided by the sector size default, which is 512 bytes. If either parameter is preceded by a 'k', i.e. 8k, then the value will be multiplied by 1024. Otherwise, the parameters will be taken literally. The default block size is (1*sector size) or 512. Note that O_DIRECT, no filesystem buffering, and some file system may not be able to perform accesses as small as 512 bytes. This will result in an IO failure with a transfer length of -1.

-c  Use a counting sequence for the bytes within to each block. The count starts at 0 and increments to 255 then begins again at 0. Each sector is filled with two of these sequences.

-C cycles
    Run until cycles access cycles are complete. When cycles is set to zero, disktest will run until killed or run time, -T, has expired. By default cycles is not used, so run time is specified by time, -T, or seeks, -L.

-d  Force disktest to dump to stdout the amount of data at the location specified by the other command-line option, i.e. -d -s50 -B 32k will dump 32768 bytes of data to stdout starting at LBA 50. The data is formatted into lines of 16 bytes with the location offset and ASCII equivalent.

-D r%:w%
    Duty cycle used while reading and/or writing. For example, -D 20:80 would cause disktest to generate a read 20% of the total run time and generate a write 80%. If only read or write is give then the percentage is always set to 100 for the specified option. If the total percentage does not add up to 100, i.e. -D 20:70, then disktest will split the remaining percentage, resulting in 25% reads and 75% writes.

-E compare_length
    Turn on error checking. Data read from filespec will be checked for correctness up to the number of bytes specified by compare_length. If compare_length is 0 then the block size is used as the compare length. By default, data read is not checked for errors.

-f fixed_pattern
    Use a data pattern consisting of a fixed value. fixed_pattern can be entered using decimal, any number not starting with a 0, octel, any number staring with a 0, or hexadecimal, any number and [A-F] starting with 0x. The value can be no greater +/- 2^63, in size.

-F  used to specify that the filespec is actually a file listing the targets that disktest should operate on. This allows disktest to run to multiple targets using the same options from a single command-line.

-h heartbeat
    Performance data will be sent to stdout every heartbeat seconds. During a linear test, -pL, only heartbeat statistics for the current operational cycle will be displayed. The default is to only display performance data at the end of the test, which is cumulative for all IO performed throughout the test.

-I IO_type
    Set the data transfer type to IO_type. Valid IO types are R (raw), B (block), or F (file) I/O. These options are case insensitive. The R (raw) type is used when binding a block device to a raw device, see raw(8). Disktest will align it's buffers correctly to support raw devices. The B (block) type is used when block IO is desired. The buffer_cache will be used during testing. Buffer alignment is not required for this type of IO operation. The F (file) type is used when accessing a file. If the file does not exist then it will be created. If the file exists, then it will opened; see O_CREAT in open(2) for more details. Access to the file is performed through the file system that the file is stored on. Adding an S modifier to the F (file) type opertaions will force an fsync(2) to occur on every write. Adding D will open with the O_DIRECT flag set. If this option is used, then I/O is limited to being aligned to the file systems block size. When transferring to a block device w/o a file system, then alignment is to 1k. These limits have been verified with the 2.4.9 kernel and the o_direct patch from AA. Disktest will report a failure if filespec does not match the IO_type specified.

-K threads
    Set the number of test threads to threads. Each child can read or write based on the specified criteria. The default number of test threads is 4.

-L seeks
    Total number of seeks to occur during testing. This option specifies the exact number of times a seek occurs on a resource. By default disktest will calculate the number of seeks by taking the difference between the start block and the stop block. If the difference is 0 then the default is 1000 seeks.

-m mark_options
    This option will add the lba and pass count to the data before any IO operation occurs. The mark_options are a which will mark each LBA with its LBA number and current pass count. The mark replaces the first 16 bytes of data in each LBA.

-n  Use a data pattern that consists of the the lba number. An lba value of up to a 32b can be stored. The 32b value is repeated to fill the transfer buffer.

-N sectors
    Set the number of available sectors to num_secs. If no num_secs is specified, and the device is a block device, then the number of sectors, as reported by the device is used, otherwise, the default number of sectors is 2000.

-p seek_pattern
    Set the pattern of seeks to seek_pattern. Valid patterns are l (linear interleaved writes/reads), L (linear writes then reads), r (random). Linear may also specify what happens when the last block is reached. Option u specifies that the test should start back at first block after reaching the last block. d specifies that the test, after reaching the last block, should start at the last block and go to the first block. The default extra option for linear is 'u'. The default seek is random.

-P perf_opts
    Record performance statistic to stdout. Perf_opts is a string of characters representing which statistics should be reported. The possible options are:
        T - Disk throughput X - Number of transfers P - Display performance data in ';' delimited format R - Display runtime A - Display all performance options

-q  Sepress all the 'INFO' level messages that are send to stdout. This includes all the assumption messages the disktest will print as it finds that the option was not specified in the command line arguments.

-Q  Sepress header data from messages that are send to stdout.

-r  Read from filespec. This is the default option if -w or -r are not specified. -E must be specified if data integrity checking is desired.

-S start_block[:end_block]
    Set the starting test block to start_block and the ending test block to end_block. By default, start_block is 0 and end_block is 2000. If end_block is not given, and filespec is a block device, then end_block is set to the volume capacity reported by the device divided by the transfer length. This option can only be used when there is a fixed pattern length.

-s start_LBA[:end_LBA]
    Set the starting test LBA to start_LBA and the ending test LBA to end_LBA. By default, start_LBA is 0 and end_LBA is 2000. If end_LBA is not given, and filespec is a block device, then end_LBA is set to the volume capacity reported by the device.

-T runtime
    Run until runtime seconds have elapsed. Runtime must always be greater than zero. -T, -L, -C are exclusive to one another.

-v  The version information will be displayed and disktest will exit normally.

-w  Write to filespec. Data will be written as fast as possible and not read back to check for data corruption. can be combined with -r option to do read/write testing and -E to perform data integrity checking.

-z  Use a randomly generated data pattern based on the seed for the bytes within to each block. The data pattern is random for the first 512 bytes, one LBA. The pattern is then repeated for each LBA after creating a pseudo random data pattern across the given filespec. This is done for two reasons. One, it saves on the memory foot print size need and time required to generate the data, and two, an LBA is the smallest unit of work disktest operates on. Therefore, disktest can maintain the ability to do data checking, random block size transfers, and random block offsets when using random data.

FILES
./disktest

ENVIRONMENT
None.

EXAMPLES
The following are some examples on how to use the options in disktest to create different types of workloads. Please use these as a guideline to get started.
    disktest -r -S10:15 -pld -L35 -B 256k -K3 -PTX /dev/sdaa This will start a read test to blocks 10 through 15. Seeks are linear and will be performed starting at 10 going to 15 then back to 10. 35 seeks will be performed. The block size 256k and there will be three threads. Also, total transfer and throughput will be displayed at the end of the test. disktest -r -w -D30:70 -K2 -E32 -B 8192 -T 600 -pR -Ibd /dev/sdzz This will start a write and read test were the work load is 30% reads and 70% writes. There will be two threads and all read data will be checked for errors up to 32 bytes. The block size is 8k and the test will run for 600 seconds. Seeks will be random and /dev/sdzz will be opened with the O_DIRECT flag set.

DIAGNOSTICS
Output Format
    All output has a header sting that displays in the following format:
        | <date>-<time> | <level> | <pid> | <version> | <device> | <message>
    The first value is the system date and time. It is expressed as:
        <MONTH>/<DAY>/<YEAR>-<HOUR>:<MIN>:<SEC>.
    The second value is the level of the message. Current levels include START, END, DEBUG, INFO, WARN, STAT, and ERROR. The third value is the process id. This can be used to match up the test processes with the output information if more then one test process is outputting to the same context, such as file. It can also be used to regenerate a test with the same seeks and random data using the -a. The fourth value is the revision number of the test process. The fifth is the target device. The sixth is the informational message. The following are some examples:
        | 11/12/01-02:05:01 | START | 1314 | v1.2.3 | /dev/sdaa | Start args: -S100:105 -K5 -pid -r -PTX -L 25 -B 1 -z /dev/sdaa | 11/12/01-02:05:01 | STAT | 1314 | v1.2.3 | /dev/sdaa | 12800 bytes read in 25 transfers. | 11/12/01-02:05:01 | STAT | 1314 | v1.2.3 | /dev/sdaa | Read Throughput 12800B/s, IOPS 25/s. | 11/12/01-02:05:01 | END | 1314 | v1.2.3 | /dev/sdaa | Test Done (Passed)
Error Checking
    When error checking is enabled, each read is compared with data that is generated by the command line options specified or assumptions made when no command line is given. If a data miscompare results the expected and actual data is printed to STDOUT, or a file if redirected, and the IO thread will die without completing any other IO operations, and set a flag to force all other threads to die. if the compare_length is not zero, then only the first compare_length bytes are compared, and only if those bytes miscompare will a data miscompare be reported.
Seeking/Accessing
    When a seek failure occurs, the following information is sent to STDOUT:
        | 11/12/01-02:05:01 | ERROR | 2250 | v1.2.3 | /dev/sdzz | lseek failed seek 10, lba = 32714, request pos = 1284, seek pos = -1
    When an access failure occurs, the following information is sent to STDOUT:
        | 11/12/01-02:05:01 | ERROR | 4492 | v1.2.3 | /dev/sdxp | disk access failed: seek 10, lba = 32714, got = 0, asked for = 8192
    An access failure can also occur on a partial access. In this case, 'got' will equal the number of bytes that were transfered.
Performance
    Performance options will display information about throughput, IO per second, and runtime. This information can be print at the end of the test only, or throughout the test at a given interval using the heartbeat option, -h.
Dumping
    When dumping data from filespec you will specify -d along with other command-line options. Here is an example:
        disktest -d -B 1k -s25 /dev/sddz
    This will dump 1024 bytes of data to stdout starting at LBA 25.
File I/O
    Distest can be used to perform filesystem IO testing. There is some setup required for this however. Disktest will not automatically create a file on the filesystem. Therefore, a file must be initialized. This is only required for read only testing. Write and read/write testing will create the file if not already created. Also note, that when creating a file using random I/O, all the LBAs in the file may not be written. This can cause disktest to show an error if a request is made to a file to an LBA that has not been previously written. The follwing is an example to initialize a file for filesystem IO testing. disktest -w -pl -N200000 -B128k test.fil This will create a ~97MB file named test.fil in the current directory writing at 131072B per transfer. Once this completes any type of IO test can be performed to this file.

TODO
The following are options that are forthcoming, ideas, and other good stuff:
    Header on first lba should include fclun, target LUN ID, etc. Mark the start of each lba with mark data. Then allow the compare function to only compare the mark areas of each lba. Add the following options:
        butterfly: seek option: test will seek lba start/end/start+1/end-1/etc... non-destructive: will read lba/write lba with read data/then read lba to verify min seek: force a minimum seek distance during any IO access max seek: force a maximum seek distance during any IO access WORO: all blocks will be written and read only once WORM: all blocks will be written only once, but read many times WRWR: a block will be written then read then written then read serialize: only one I/O request is ever outstanding no mater how many threads retry: number of times an I should be retried before counting as a failure Add option for MxN testing. This will allow the specification of multiple targets, M, with multiple thread, N, operation on each target.

AUTHOR
Brent Yardley (yardleyb@us.ibm.com)