m2-storage-benchmark.sh
Bash script to mount an M.2 NVMe storage and run a performance benchmark with fio.
Insert an M.2 NVMe drive into the dedicated slot on the Smart Display Module. Ensure the NVMe driver is loaded. The script mounts the drive and runs fio to measure IOPS and latency. Ideal for testing AI accelerators or fast storage.
m2-storage-benchmark.sh
#!/bin/bash
# Vérifie si le périphérique NVMe est monté
MOUNT_POINT="/mnt/nvme"
DEVICE="/dev/nvme0n1"
if [ ! -d "$MOUNT_POINT" ]; then
echo "Création du point de montage..."
sudo mkdir -p $MOUNT_POINT
sudo mount $DEVICE $MOUNT_POINT
fi
echo "Démarrage du benchmark FIO sur $MOUNT_POINT..."
# Installation de fio si nécessaire
if ! command -v fio &> /dev/null
then
echo "Installation de fio..."
sudo apt update && sudo apt install -y fio
fi
fio --name=test --ioengine=libaio --direct=1 --bs=4k --iodepth=64 --size=1G --readwrite=randrw --rwmixread=70 --runtime=30 --time_based --directory=$MOUNT_POINT
echo "Benchmark terminé."