Test Drive Performance
If you want to test the speed of your disk you can run a few benchmarks. One thing to note is that depending on how the disk will be used the
performance will vary. Below are a few different types of benchmarks along with what they test. Make sure to replace the location of the testfile
to point to
the disk you want to test. For me this location is /media/raid0/testfile
If you do not have fio get it installed first
sudo apt install fio
Random Read/Write (4K Block Size)
This test uses a small block size (4K) to simulate random I/O operations, which is typical for database workloads or small file operations.
--bs=4K
: Small block size, good for random I/O testing.--rw=randrw
: Mix of random read/write operations.--rwmixread=50
: 50% reads, 50% writes.--numjobs=4
: Simulates 4 simultaneous jobs (threads).--runtime=60
: Test runs for 60 seconds.
sudo fio --name=random_rw --filename=/<YOUR PATH>/testfile --size=10G --bs=4K --ioengine=libaio --direct=1 --rw=randrw --rwmixread=50 --runtime=60 --numjobs=4 --time_based --group_reporting
Sequential Read/Write (1M Block Size)
This test uses a larger block size (1M) to simulate sequential operations, like those in large file transfers or streaming.
--bs=1M
: Large block size, good for sequential I/O testing.--rw=rw
: Sequential read/write test.--rwmixread=50
: 50% reads, 50% writes.--numjobs=4
: Simulates 4 jobs to measure performance under load.
sudo fio --name=sequential_rw --filename=/<YOUR PATH>/testfile --size=10G --bs=1M --ioengine=libaio --direct=1 --rw=rw --rwmixread=50 --runtime=60 --numjobs=4 --time_based --group_reporting
Sequential Read Only (1M Block Size)
This tests the drive's sustained read performance using a large block size
--rw=read
: Sequential read test
sudo fio --name=sequential_read --filename=/<YOUR PATH>/testfile --size=10G --bs=1M --ioengine=libaio --direct=1 --rw=read --runtime=60 --numjobs=4 --time_based --group_reporting
Random Write Only (4K Block Size)
This tests the drive's random write performance using a small block size.
--bs=4K/1M
: Block size. Use smaller sizes (e.g., 4K) for random I/O tests and larger sizes (e.g., 1M) for sequential I/O.--rw=randrw/rw
: Specifies the type of read/write operation. randrw mixes random reads/writes, while rw is for sequential read/write.--rwmixread=50
: Specifies the mix of reads and writes (50% read, 50% write). Adjust as needed.--numjobs=4
: Simulates four concurrent jobs/threads to increase I/O load, mimicking multi-threaded access patterns.--size=10G
: The size of the test file (adjust based on your drive’s capacity).--direct=1
: Direct I/O, bypassing caches for true performance.--time_based
: Run the test for the specified runtime rather than just completing the file size.
sudo fio --name=random_write --filename=/<YOUR PATH>/testfile --size=10G --bs=4K --ioengine=libaio --direct=1 --rw=randwrite --runtime=60 --numjobs=4 --time_based --group_reporting
Interpreting Your Results
- Bandwidth (BW): The throughput of the drive, reported in MB/s (higher is better).
- IOPS (Input/Output Operations Per Second): A measure of how many read/write operations the drive can handle per second. For random tests, this is a key metric (higher is better).
- Latency: How long each I/O operation takes (lower is better).