nvme-benchmark-fio.sh
Bash script using fio to evaluate bandwidth and latency of the NVMe storage.
Ensure the 'fio' package is installed. This script creates a temporary 1 GB file to bypass the OS cache. It launches sequential read and write tests with high queue depth to saturate the PCIe 4.0 bus. Results display throughput in MB/s and latency in microseconds.
nvme-benchmark-fio.sh
#!/bin/bash
# Benchmark de performance pour le SSD NVMe de la LattePanda Sigma 2
# Nécessite l'installation de fio : sudo apt install fio
DISK="/dev/nvme0n1"
TEST_FILE="/tmp/nvme_test.bin"
SIZE="1G"
echo "Préparation du fichier de test de $SIZE..."
fio --name=prep --rw=write --bs=1M --size=$SIZE --filename=$TEST_FILE --direct=1 --ioengine=libaio --iodepth=16
echo "Test de lecture séquentielle (4K)..."
fio --name=read_seq --rw=read --bs=4k --size=$SIZE --filename=$TEST_FILE --direct=1 --ioengine=libaio --iodepth=32 --numjobs=4 --group_reporting
echo "Test d'écriture séquentielle (4K)..."
fio --name=write_seq --rw=write --bs=4k --size=$SIZE --filename=$TEST_FILE --direct=1 --ioengine=libaio --iodepth=32 --numjobs=4 --group_reporting
rm $TEST_FILE
echo "Test terminé."