Biduleohm

Self-adaptive script for the drives

Sep 4th, 2015
2,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. Replace this:
  2.  
  3. drives="da0 da1 da2 da3 da4 da5 da6 da7"
  4.  
  5. by this :
  6.  
  7. drives=$(for drive in $(sysctl -n kern.disks); do \
  8. if [ "$(smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}')" ]
  9. then printf ${drive}" "; fi done | awk '{for (i=NF; i!=0 ; i--) print $i }')
Add Comment
Please, Sign In to add comment