diff --git a/driveAtlas.sh b/driveAtlas.sh index f2e2d50..9579fe2 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -117,51 +117,61 @@ get_drive_info() { fi } -# Show NVMe Drives with enhanced info -echo -e "\n=== NVMe Drives ===\n" -printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MODEL" -echo "------------------------------------------------------------" +# Initialize array for "not found" messages +not_found=() + +# Show NVMe Drives only if present nvme_drives=$(sudo nvme list | grep "^/dev") if [ -n "$nvme_drives" ]; then + echo -e "\n=== NVMe Drives ===\n" + printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MODEL" + echo "------------------------------------------------------------" echo "$nvme_drives" | awk '{printf "%-15s %-10s %-10s %-20s\n", $1, $6, "NVMe", $3}' else - echo "No NVMe drives found" + not_found+=("NVMe drives") fi -# Show MMC Drives -echo -e "\n=== MMC Drives ===\n" -printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MOUNTPOINT" -echo "------------------------------------------------------------" -mmc_output=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep "mmcblk") +# Show MMC Drives only if present +mmc_output=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep "mmcblk" | sort) if [ -n "$mmc_output" ]; then + echo -e "\n=== MMC Drives ===\n" + printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MOUNTPOINT" + echo "------------------------------------------------------------" echo "$mmc_output" -else - echo "No MMC drives found" fi -# Show SATA/Other Drives -echo -e "\n=== SATA/Block Drives ===\n" -printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MOUNTPOINT" -echo "------------------------------------------------------------" -sata_output=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep "disk" | grep -v "mmcblk") +# Show SATA Drives only if present +sata_output=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep "disk" | grep -v "mmcblk" | grep -v "rbd" | sort) if [ -n "$sata_output" ]; then + echo -e "\n=== SATA Drives ===\n" + printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MOUNTPOINT" + echo "------------------------------------------------------------" echo "$sata_output" -else - echo "No SATA drives found" fi -# Add RAID Detection -echo -e "\n=== RAID Configuration ===" -if [ -f /proc/mdstat ]; then - cat /proc/mdstat +# Show Ceph RBD Devices only if present +rbd_output=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep "rbd" | sort -V) +if [ -n "$rbd_output" ]; then + echo -e "\n=== Ceph RBD Devices ===\n" + printf "%-15s %-10s %-10s %-20s\n" "DEVICE" "SIZE" "TYPE" "MOUNTPOINT" + echo "------------------------------------------------------------" + echo "$rbd_output" else - echo "No software RAID detected" + not_found+=("RBD devices") fi -# 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" +# Check RAID +if ! [ -f /proc/mdstat ] || ! grep -q "active" /proc/mdstat; then + not_found+=("Software RAID") +fi + +# Check ZFS +if ! command -v zpool >/dev/null 2>&1 || [ -z "$(sudo zpool status 2>/dev/null)" ]; then + not_found+=("ZFS pools") +fi + +# Display consolidated "not found" messages at the end +if [ ${#not_found[@]} -gt 0 ]; then + echo -e "\n=== Not Found ===\n" + printf "%s\n" "${not_found[@]}" fi \ No newline at end of file