From dfa19271d0f4f9f14bf37792bad9028a0e002105 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 9 Dec 2024 22:07:59 -0500 Subject: [PATCH] Enhanced README.md and added SMART status indications --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ driveAtlas.sh | 50 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 81 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e69de29..0d43b1a 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,44 @@ +# Drive Atlas + +A powerful server drive mapping tool that generates visual ASCII representations of server layouts and provides comprehensive drive information based on the server's hostname. + +## Features + +- 🖼️ Visual ASCII art maps for different server types (large1, medium1, medium2, micro1/2) +- 💽 Detailed NVMe drive information +- 🔄 SATA drive listing with size and mount points +- 🔍 PCI Bus Device Function (BDF) details +- 📝 Drive identification by unique device IDs + +## Quick Start + +Execute remotely using either command: + +```bash +bash <(curl -s http://10.10.10.110:3000/JWS/driveAtlas/raw/branch/main/driveAtlas.sh) + ``` +- Using `wget`: + ```bash + bash <(wget -qO- http://10.10.10.110:3000/JWS/driveAtlas/raw/branch/main/driveAtlas.sh) +``` + +## Requirements +Linux environment with bash +sudo privileges for NVMe operations +curl or wget for remote execution +## Server Types +The script supports different server layouts: + +Type Description +large1 3x3 grid layout (9 drives) +medium1 2x4 + 2 layout (10 drives) +medium2 Single row layout (10 drives) +micro1/2 Compact 2-drive layout +## Output Example +The script provides: + +ASCII visualization of server layout +NVMe drive listing +SATA drive information +PCI BDF details +Drive ID mappings \ No newline at end of file diff --git a/driveAtlas.sh b/driveAtlas.sh index d7b9f34..f7f5c54 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -106,22 +106,46 @@ case "$HOSTNAME" in ;; esac -# Show NVMe Drives -echo -e "\n=== NVMe Drives ===" -sudo nvme list +# Enhanced Drive Information Function +get_drive_info() { + local drive=$1 + echo "=== Detailed info for $drive ===" + if [[ $drive == *"nvme"* ]]; then + sudo nvme smart-log "$drive" + else + sudo smartctl -A "$drive" | grep -E "Temperature|Power|Health" + fi +} -# Show SATA Drives +# Show NVMe Drives with enhanced info +echo -e "\n=== NVMe Drives ===" +nvme_drives=$(sudo nvme list | grep "^/dev") +echo "$nvme_drives" +for drive in $(echo "$nvme_drives" | awk '{print $1}'); do + get_drive_info "$drive" +done + +# Show SATA Drives with enhanced info echo -e "\n=== SATA Drives ===" lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,MODEL | grep disk +for drive in $(lsblk -dnp -o NAME); do + get_drive_info "$drive" +done -# Show PCI BDF for NVMe -echo -e "\n=== PCI BDF for NVMe ===" -lspci | grep -i nvme +# [Previous PCI BDF and disk ID sections remain the same...] -# Show PCI BDF for SATA -echo -e "\n=== PCI BDF for SATA ===" -lspci | grep -i sata +# Add RAID Detection +echo -e "\n=== RAID Configuration ===" +if [ -f /proc/mdstat ]; then + cat /proc/mdstat +else + echo "No software RAID detected" +fi -# Show Drives by ID -echo -e "\n=== Drives by ID ===" -ls -l /dev/disk/by-id \ No newline at end of file +# Add ZFS Detection +echo -e "\n=== ZFS Pools ===" +if command -v zpool >/dev/null 2>&1; then + sudo zpool status +else + echo "ZFS not installed" +fi \ No newline at end of file