Browse Source

Update syno_hdd_db.sh

Fixed issue where drives weren't detected if NAS was updated from DSM 6 to DSM 7, and models like the DVA3219 using sata# even in DSM 6.
pull/15/head v1.0.1
007revad 3 years ago
committed by GitHub
parent
commit
045352a242
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      syno_hdd_db.sh

41
syno_hdd_db.sh

@ -51,28 +51,25 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Get list of installed HDDs and SATA SSDs # Get list of installed HDDs and SATA SSDs
if [[ $dsm -gt "6" ]]; then # SATA drives, sata1, sata2 etc
# DSM 7 (sata drives, sata1, sata2 etc) for drive in /dev/sata*; do
# for drive in /dev/sata[0-9]{1,2}; do tmp=$(hdparm -i "$drive" | grep Model)
for drive in /dev/sata*; do hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2)
tmp=$(hdparm -i "$drive" | grep Model) fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2)
hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2) if [[ $hdmodel ]] && [[ $fwrev ]]; then
fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2) hdparm+=("${hdmodel},${fwrev}")
if [[ $hdmodel ]] && [[ $fwrev ]]; then fi
hdparm+=("${hdmodel},${fwrev}") done
fi
done # SATA drives, sda, sdb etc
else for drive in /dev/sd[a-z]{1,2}; do
# DSM 6 (sata drives, sda, sdb etc) tmp=$(hdparm -i "$drive" | grep Model)
for drive in /dev/sd[a-z]{1,2}; do hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2)
tmp=$(hdparm -i "$drive" | grep Model) fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2)
hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2) if [[ $hdmodel ]] && [[ $fwrev ]]; then
fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2) hdparm+=("${hdmodel},${fwrev}")
if [[ $hdmodel ]] && [[ $fwrev ]]; then fi
hdparm+=("${hdmodel},${fwrev}") done
fi
done
fi
# Sort hdparm array into new hdds array to remove duplicates # Sort hdparm array into new hdds array to remove duplicates
if [[ ${#hdparm[@]} -gt "0" ]]; then if [[ ${#hdparm[@]} -gt "0" ]]; then

Loading…
Cancel
Save