Browse Source

Merge pull request #58 from 007revad/develop

Develop
pull/91/head v2.1.37
Dave Russell 3 years ago
committed by GitHub
parent
commit
73b6215945
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGES.txt
  2. 7
      README.md
  3. 67
      syno_hdd_db.sh

5
CHANGES.txt

@ -1,5 +1,10 @@
v2.1.37
- Now edits max supported memory to match the amount of memory installed, if installed memory is greater than the current max memory setting.
- Minor improvements.
v2.0.36
- Show the options used.
- Thank you to Gummibando on reddit for their donation.
v2.0.35
- Now allows creating M.2 storage pool and volume all from Storage Manager.

7
README.md

@ -21,6 +21,8 @@ #### What the script does:
* Prevents DSM auto updating the drive database.
* Optionally disable DSM's "support_disk_compatibility".
* Optionally disable DSM's "support_memory_compatibility" to prevent <a href=images/ram_wanring.png/>non-Synology memory notifications</a>.
* Optionally edits max supported memory to match the amount of memory installed, if installed memory is greater than the current max memory setting.
- Minor improvements.
* Checks that M.2 volume support is enabled (on models that have M.2 slots or PCIe slots).
* Enables creating M.2 storage pools and volumes from within Storage Manager.
* Makes DSM recheck disk compatibility so rebooting is not needed (DSM 7 only).
@ -84,3 +86,8 @@ ### Running the script via SSH
- Thanks to dwabraxus and aferende for help detecting connected expansion units.
- Thanks to bartoque on the Synology subreddit for the tip on making the script download the latest release from github.
- Thanks to nicolerenee for pointing out the easiest way to enable creating M.2 storage pools and volumes in Storage Manager.
**Donators**
- A big thank you to Gummibando on reddit for their donation.

67
syno_hdd_db.sh

@ -30,6 +30,8 @@
# It's also parsed and checked and probably in some cases it could be more critical to patch that one instead.
# DONE
# Now edits max supported memory to match the amount of memory installed, if greater than the current max memory setting.
#
# Now allows creating M.2 storage pool and volume all from Storage Manager
#
# Now always shows your drive entries in the host db file if -s or --showedits used,
@ -113,7 +115,7 @@
# Optionally disable "support_disk_compatibility".
scriptver="v2.0.36"
scriptver="v2.1.37"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"
@ -213,6 +215,12 @@ else
fi
if [[ $debug == "yes" ]]; then
# set -x
export PS4='`[[ $? == 0 ]] || echo "\e[1;31;40m($?)\e[m\n "`:.$LINENO:'
fi
# Check script is running as root
if [[ $( whoami ) != "root" ]]; then
echo -e "${Error}ERROR${Off} This script must be run as root or sudo!"
@ -762,7 +770,7 @@ updatedb() {
editdb7 "append" "$2"
fi
elif [[ $dbtype -eq "6" ]];then
elif [[ $dbtype -eq "6" ]]; then
# example:
# {"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]},
# Don't need to add firmware version?
@ -808,7 +816,7 @@ while [[ $num -lt "${#hdds[@]}" ]]; do
num2="0"
while [[ $num2 -lt "${#eunits[@]}" ]]; do
eudb="${dbpath}${eunits[$num2],,}${version}.db"
if [[ -f "$eudb" ]];then
if [[ -f "$eudb" ]]; then
backupdb "$eudb" &&\
updatedb "${hdds[$num]}" "$eudb"
else
@ -833,7 +841,7 @@ while [[ $num -lt "${#nvmes[@]}" ]]; do
# M.2 adaptor cards
num2="0"
while [[ $num2 -lt "${#m2carddbs[@]}" ]]; do
if [[ -f "${dbpath}${m2carddbs[$num2]}" ]];then
if [[ -f "${dbpath}${m2carddbs[$num2]}" ]]; then
backupdb "${dbpath}${m2carddbs[$num2]}" &&\
updatedb "${nvmes[$num]}" "${dbpath}${m2carddbs[$num2]}"
else
@ -859,7 +867,8 @@ setting="$(get_key_value $synoinfo $sdc)"
if [[ $force == "yes" ]]; then
if [[ $setting == "yes" ]]; then
# Disable support_disk_compatibility
sed -i "s/${sdc}=\"yes\"/${sdc}=\"no\"/" "$synoinfo"
#sed -i "s/${sdc}=\"yes\"/${sdc}=\"no\"/" "$synoinfo"
synosetkeyvalue "$synoinfo" "$sdc" "no"
setting="$(get_key_value "$synoinfo" $sdc)"
if [[ $setting == "no" ]]; then
echo -e "\nDisabled support disk compatibility."
@ -868,7 +877,8 @@ if [[ $force == "yes" ]]; then
else
if [[ $setting == "no" ]]; then
# Enable support_disk_compatibility
sed -i "s/${sdc}=\"no\"/${sdc}=\"yes\"/" "$synoinfo"
#sed -i "s/${sdc}=\"no\"/${sdc}=\"yes\"/" "$synoinfo"
synosetkeyvalue "$synoinfo" "$sdc" "yes"
setting="$(get_key_value "$synoinfo" $sdc)"
if [[ $setting == "yes" ]]; then
echo -e "\nRe-enabled support disk compatibility."
@ -883,7 +893,8 @@ setting="$(get_key_value $synoinfo $smc)"
if [[ $ram == "yes" ]]; then
if [[ $setting == "yes" ]]; then
# Disable support_memory_compatibility
sed -i "s/${smc}=\"yes\"/${smc}=\"no\"/" "$synoinfo"
#sed -i "s/${smc}=\"yes\"/${smc}=\"no\"/" "$synoinfo"
synosetkeyvalue "$synoinfo" "$smc" "no"
setting="$(get_key_value "$synoinfo" $smc)"
if [[ $setting == "no" ]]; then
echo -e "\nDisabled support memory compatibility."
@ -892,7 +903,8 @@ if [[ $ram == "yes" ]]; then
else
if [[ $setting == "no" ]]; then
# Enable support_memory_compatibility
sed -i "s/${smc}=\"no\"/${smc}=\"yes\"/" "$synoinfo"
#sed -i "s/${smc}=\"no\"/${smc}=\"yes\"/" "$synoinfo"
synosetkeyvalue "$synoinfo" "$smc" "yes"
setting="$(get_key_value "$synoinfo" $smc)"
if [[ $setting == "yes" ]]; then
echo -e "\nRe-enabled support memory compatibility."
@ -900,6 +912,31 @@ else
fi
fi
# Get total amount of installed memory
if [[ $ram == "yes" ]]; then
IFS=$'\n' read -r -d '' -a array < <(dmidecode -t memory | grep -i 'size')
if [[ ${#array[@]} -gt "0" ]]; then
num="0"
while [[ $num -lt "${#array[@]}" ]]; do
ramsize=$(printf %s "${array[num]}" | cut -d" " -f2)
if [[ $ramtotal ]]; then
ramtotal=$((ramtotal +ramsize))
else
ramtotal="$ramsize"
fi
num=$((num +1))
done
fi
setting="$(get_key_value $synoinfo mem_max_mb)"
if [[ $ramtotal -gt $setting ]]; then
synosetkeyvalue "$synoinfo" mem_max_mb "$ramtotal"
setting="$(get_key_value $synoinfo mem_max_mb)"
if [[ $setting == "$ramtotal" ]]; then
echo -e "\nSet max memory to $ramtotal MB."
fi
fi
fi
# Enable m2 volume support
if [[ $m2 != "no" ]]; then
@ -909,12 +946,13 @@ if [[ $m2 != "no" ]]; then
setting="$(get_key_value $synoinfo ${smp})"
enabled=""
if [[ ! $setting ]]; then
# Add support_m2_pool"yes"
# Add support_m2_pool="yes"
echo 'support_m2_pool="yes"' >> "$synoinfo"
enabled="yes"
elif [[ $setting == "no" ]]; then
# Change support_m2_pool"no" to "yes"
sed -i "s/${smp}=\"no\"/${smp}=\"yes\"/" "$synoinfo"
# Change support_m2_pool="no" to "yes"
#sed -i "s/${smp}=\"no\"/${smp}=\"yes\"/" "$synoinfo"
synosetkeyvalue "$synoinfo" "$smp" "yes"
enabled="yes"
elif [[ $setting == "yes" ]]; then
echo -e "\nM.2 volume support already enabled."
@ -944,7 +982,8 @@ if [[ $nodbupdate == "yes" ]]; then
disabled="yes"
elif [[ $url != "127.0.0.1" ]]; then
# Edit drive_db_test_url=
sed -i "s/drive_db_test_url=.*/drive_db_test_url=\"127.0.0.1\"/" "$synoinfo" >/dev/null
#sed -i "s/drive_db_test_url=.*/drive_db_test_url=\"127.0.0.1\"/" "$synoinfo" >/dev/null
synosetkeyvalue "$synoinfo" "$dtu" "127.0.0.1"
disabled="yes"
fi
@ -986,10 +1025,10 @@ fi
# Show the changes
if [[ ${showedits,,} == "yes" ]]; then
getdbtype "$db1"
if [[ $dbtype -gt "6" ]];then
if [[ $dbtype -gt "6" ]]; then
# Show 11 lines after hdmodel line
lines=11
elif [[ $dbtype -eq "6" ]];then
elif [[ $dbtype -eq "6" ]]; then
# Show 2 lines after hdmodel line
lines=2
fi

Loading…
Cancel
Save