User Tools

Site Tools


truenas:drives:list_drives

TrueNAS - Drives - List Drives

Lists the hard drives into the nice table along with the GPTID numbers and the serial numbers.

#!/bin/sh
 
drives="da0 da1 da2 da3 da4 da5 da6 da7 da8 da9 da10 da11 da12 da12 da13
da14 da15 da16 da17 da18 da19 da20 da21 da22 da23 da24 da25 da26 da27
da28 da29 da30 da31 da32 da33 da34 da35 da36 da37 da38 da39 da40 da41
da42 da43 da44 da45 da46 da47 da48 da49 da50 da51 da52 da53 da54 da55
da56 da57 da58 da59"
 
echo ""
echo "+========+============================================+=================+"
echo "| Device | GPTID                                      | Serial          |"
echo "+========+============================================+=================+"
for drive in $drives
do
  gptid=`glabel status -s "${drive}p2" | awk '{print $1}'`
  serial=`smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}'`
  printf "| %-6s | %-42s | %-15s |\n" "$drive" "$gptid" "$serial"
  echo "+--------+--------------------------------------------+-----------------+"
done
echo ""

truenas/drives/list_drives.txt · Last modified: 2022/08/16 18:01 by 185.198.243.244

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki