SPEW(1)
π spew β user commands, section 1 π
hii bestie π welcome to the spew manual, the little tool that measures I/O performance and/or generates I/O load. she's a User Command, she lives in section 1, and she's about to tell you everything.
β¨ NAME β¨
spew β measures I/O performance and/or generates I/O load
πΈ SYNOPSIS πΈ
spew --write|--read|--read-after-write [OPTION]... TRANSFER_SIZE[kKmMgG]
FILE
π¦ DESCRIPTION π¦
An I/O performance measurement and load generation tool. Writes and/or reads generated data to or from a character device, block device, or regular file.
no cap, that's the whole vibe. now here are the flags, and there are A LOT of them, so hydrate π
-B,--max-buffer-size=BUFFER_SIZEβ eachread(2)/write(2)call uses a maximum buffer of sizeBUFFER_SIZE.-b,--min-buffer-size=BUFFER_SIZEβ eachread(2)/write(2)call uses a minimum buffer of sizeBUFFER_SIZE.-c,--continue-after-errorβ keep going after data integrity errors.-d,--directβ use direct I/O. should only be used on block device files. not all operating systems support direct I/O.-g,--generate-loadβ equivalent to:-v -t -P -p random -i 0.-i,--iterations=COUNTβ write/read dataCOUNTtimes. if count is0, it repeats forever.-l,--logfile=LOGFILEβ send log messages toLOGFILE.--no-progressβ don't show progress (default).--no-rcfilesβ don't use standard rcfiles.-q,--no-statisticsβ don't output statistics.--no-tuiβ don't use TUI interface.-o,--offset=OFFSETβ seek toOFFSETbefore starting I/O.-P,--progressβ show progress.-p,--pattern=PATTERNβ use data patternPATTERNwhen reading or writing data.-r,--randomβ read/write buffers to random offsets.--rawβ an alias for--read-after-write.--rcfile=RCFILEβ read command-line options fromRCFILE.--readβ read data fromFILE.--read-after-writeβ read back data after writing toFILE.-S,--seed=SEEDβ useSEEDfor random number seed.-s,--syncβ use synchronous I/O.--statisticsβ output statistics (default).-t,--tuiβ use curses-based, terminal user interface.-u,--units=UNITSβ show transfer rate inUNITSunits.--usageβ show brief usage message and exit.-V,--versionβ output version information and exit.-v,--detailed-statisticsβ output detailed statistics.--writeβ write data toFILE.-?,--helpβ show this help and exit.
and the lil positional / argument besties, in order:
FILEβ regular or device file to write data to.LOGFILEβ path to a file used for logging.MAX_BUFFER_SIZEβ minimum buffer size used in eachread(2)/write(2)call (default isMIN_BUFFER_SIZEbytes).MAX_BUFFER_SIZEmust be an even multiple of 512 bytes and can be specified in bytes, kibibytes(k), kilobytes(K), mebibytes(m), megabytes(M), gibibytes(g), gigabytes(G), tebibytes(t), or terabytes(T).MAX_BUFFER_SIZEdefaults toMIN_BUFFER_SIZE. ifMAX_BUFFER_SIZE>MIN_BUFFER_SIZE, random buffer sizes between the two limits are used.MAX_BUFFER_SIZEmust be an even multiple ofMIN_BUFFER_SIZE.MIN_BUFFER_SIZEβ minimum buffer size used in eachread(2)/write(2)call (default is 512 bytes).MIN_BUFFER_SIZEmust be an even multiple of 512 bytes and can be specified in bytes, kibibytes(k), kilobytes(K), mebibytes(m), megabytes(M), gibibytes(g), gigabytes(G), tebibytes(t), or terabytes(T).OFFSETβ position to seek to in the file before starting I/O (default is0).OFFSETmust be an even multiple of 512 bytes and can be specified in bytes, kibibytes(k), kilobytes(K), mebibytes(m), megabytes(M), gibibytes(g), gigabytes(G), tebibytes(t), or terabytes(T).PATTERNβ data pattern used when writing/reading data. available patterns are:none,zeros,ones,alt,random,numbers, and"#"(where"#"is a number between 0-255). the default pattern is"none".RCFILEβ read additional command-line options fromRCFILE. other options on the command-line will override options inRCFILE.SEEDβ used to seed the random number generator. must be >= 1 and <= 2^32.TRANSFER_SIZEβ total number of bytes to transfer (must be an even multiple of bothMIN_BUFFER_SIZEandMAX_BUFFER_SIZE).TRANSFER_SIZEcan be specified in bytes, kilobytes, megabytes, or gigabytes.UNITSβ kibibytes(k), kilobytes(K), mebibytes(m), megabytes(M), gibibytes(g), gigabytes(G), tebibytes(t), or terabytes(T).
π₯ EXAMPLES π₯
okay this is the fun part, let's see her in action π«Ά
spew --write -b 16k 1m /tmp/bigfile
or
spew -b 16k 1m /tmp/bigfile
writes 1 mebibyte (1 mebibyte = 1024*1024 bytes) using 16 kibibytes (1 kibibyte = 1024 bytes) requests to the file /tmp/bigfile using the default pattern (random). displays the write transfer rate in kibibytes per second and the write transfer time in seconds. iconic.
spew --write -u m -i 10 -b 1k 256k /dev/sda1
or
spew -u m -i 10 -b 1k 256k /dev/sda1
writes 256 kibibytes using 1 kibibyte requests to the block device file /dev/sda1 10 times using the default pattern (random). the iteration and cumulative write transfer rates are displayed in mebibytes per second and the iteration and cumulative write transfer times are displayed in seconds.
spew --raw -d -o 1m -b 16m 1g /tmp/bigfile
or
regorge -s -o 1m -b 16m 1g /tmp/bigfile
write 1 gibibyte (1 gibibyte = 1024*1024*1024 bytes) starting at an offset of 1 mebibyte using 16 mebibyte requests to the file /tmp/bigfile using the default pattern (random). the data is written synchronously and flushed at file close. then read in the same data using the same request size and offset. the data is checked to ensure that the data read in matches the data read out. write and read transfer rates are displayed in kibibytes/second. read and write transfer times are displayed in seconds. she's thorough π
spew --read -i 0 -u M -p zeros -b 512 1m /dev/zero
or
gorge -i 0 -u M -p zeros -b 512 1m /dev/zero
read 1 mebibyte of data using 512 byte requests from the file /dev/zero an infinite number of times using the zeros pattern (don't check the data). the iteration and cumulative read transfer rates are displayed in megabytes (1 megabyte = 1,000,000 bytes) per second and the iteration and cumulative read transfer times are displayed in seconds.
spew --raw -g -r -b 1k -B 256K 1t /dev/md1
or
regorge -g -r -b 1k -B 256K 1t /dev/md1
write 1 tebibyte (1 tebibyte = 1024*1024*1024*1024 bytes) using 1-256 kibibyte requests to the block device /dev/md1 using the random pattern. random seeks are performed before each transfer, but each block between the start and end of the data is written exactly once. the request sizes are chosen randomly. then read in the same data using the same request sizes and seeks in the same sequence. repeat the above sequence an infinite number of times until told to quit (via signal or TUI command).
the data is checked to ensure that the data read in matches the data read out. a curses-based TUI is used to display iteration and cumulative transfer rates, transfer times, and bytes transferred. display verbose statistics after quitting. main character energy fr fr π
π§ ALGORITHMS π§
the following algorithm is used to determine blocksize when MAX_BUFFER_SIZE > MIN_BUFFER_SIZE:
find the largest blocksize that is a power of 2 and is >= MAX_BUFFER_SIZE. call this maxbuffersize. find the smallest buffersize that is a power of 2 and is >= MIN_BUFFER_SIZE. call this minbuffersize. Chunksize = maxbuffersize * (difference in number of bits between min and maxbuffersize + 1). the number of chunks is TRANSFER_SIZE/chunksize. call this numchunks. there will be numchunks number of read/writes that are of size maxbuffersize, 2 * numchunks number of read/writes that are of size maxbuffersize/2, 4 * numchunks number of read/writes that are of size maxbuffersize/4, and so on until minbuffersize is reached. MIN_BUFFER_SIZE is used for any remaining transfers if TRANSFER_SIZE is not evenly divisible by chunksize.
example: using a MIN_BLOCK_SIZE of 1k, a MAX_BLOCK_SIZE of 8k and a TRANSFER_SIZE of 264k results in 8 8k read/writes, 16 4k read/write, 32 2k read/writes, and 64 + 8 1k read/writes. math ate that π
π PATTERNS π
use the following od(1) command to examine spew generated files where a data integrity problem has occurred:
od -A d --format=d8 --width=32 <file>
note the double space before <file>, bestie β we keep it real here π
β FILES β
$HOME/.spewrcor$SPEWRCβ holds user default options. these options precede any options included on the command-line./etc/spew.confβ holds system-wide default options. these options precede any options included on the command-line and options included from$HOME/.spewrcor$SPEWRC.
π AUTHOR π
Written by Andrew Patterson <andrew.patterson@hp.com>
π REPORTING BUGS π
Report bugs to Andrew Patterson <andrew.patterson@hp.com>.
Copyright 2007 Hewlett-Packard Corp.
and that's the whole thing, bestie π you now know spew better than she knows herself. go forth and benchmark responsibly π
this page is from spew version 1.0.8, dated May 2010 β vintage, lowkey, and still slaying β¨π¦ love u, bye π
π
π¦ where this page comes from
- debian bookworm: spew 1.0.8-1.1
- debian trixie: spew 1.0.8-1.2 Β· GPL-2.0-only
- ubuntu jammy: spew 1.0.8-1build5
- ubuntu noble: spew 1.0.8-1.1
- ubuntu questing: spew 1.0.8-1.2
- ubuntu resolute: spew 1.0.8-2 Β· GPL-2.0-only
- ubuntu stonking: spew 1.0.8-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms