m2-ssd-mount-check.sh
Bash script to detect, create mount point, and mount an NVMe drive connected to the M.2 slot.
Specific to the Smart Display Module with its M.2 slot. Ensure the SSD is properly inserted and formatted (e.g., ext4). The script checks for the presence of /dev/nvme0n1p1. Make the script executable with 'chmod +x' and run with sudo. Useful for digital signage systems requiring fast storage.
m2-ssd-mount-check.sh
#!/bin/bash
# Vérifier si le module M.2 est détecté
if ls /dev/nvme0n1* 1> /dev/null 2>&1; then
echo "SSD NVMe détecté."
# Créer le point de montage si nécessaire
MOUNT_POINT="/mnt/m2_storage"
if [ ! -d "$MOUNT_POINT" ]; then
sudo mkdir -p "$MOUNT_POINT"
fi
# Monter la partition (supposée être ext4, ajuster selon le formatage)
if ! mountpoint -q "$MOUNT_POINT"; then
sudo mount /dev/nvme0n1p1 "$MOUNT_POINT"
echo "SSD monté sur $MOUNT_POINT"
else
echo "SSD déjà monté."
fi
else
echo "Aucun SSD NVMe détecté dans le slot M.2."
fi