ioping is probably the easiest tool to investigate and obtain the latency and speed of storage devices. It is inspired by the class ping networking tool and offers a similar output at the shell.
$ sudo apt install ioping
$ ioping /home/joe/somefile $ ioping /home/joe $ sudo ioping /dev/sda1
If a file is specified, make sure the file exists and its filesize is greater or equal to the request size (default is 4KiB). If a device or partition is specified, you might need to provide root privileges.
Here is a sample output on a directory:
$ ioping /home/joe 4 KiB <<< /home/joe (ext4 /dev/mmcblk0p2): request=1 time=512.8 us (warmup) 4 KiB <<< /home/joe (ext4 /dev/mmcblk0p2): request=2 time=2.74 ms 4 KiB <<< /home/joe (ext4 /dev/mmcblk0p2): request=3 time=2.73 ms 4 KiB <<< /home/joe (ext4 /dev/mmcblk0p2): request=4 time=2.74 ms ^C --- /home/joe (ext4 /dev/mmcblk0p2) ioping statistics --- 3 requests completed in 8.22 ms, 12 KiB read, 365 iops, 1.43 MiB/s generated 4 requests in 3.56 s, 16 KiB, 1 iops, 4.49 KiB/s min/avg/max/mdev = 2.73 ms / 2.74 ms / 2.74 ms / 6.21 us
Note that the tool prints stats for read operations by default. From the above output, we can see the device/partition that is being tested (
/dev/mmcblk0p2) and its filesystem (
ext4). There was 1 warmup request and 3 test requests before the program was stopped using
Ctrl+C. The requests are each of size 4 KiB which can be deduced from the total
12 KiB read in the output. The speed for requests of 4 KiB seems to be 1.43 MiB/s. Finally, the average latency for this device seems to be 2.74 ms.
$ ioping -s 4M /home/joe
$ ioping -W /home/joe
$ ioping -G /home/joe
Tried with: ioping 1.1 and Ubuntu 20.04