From bcea0136f44a9bd38b766f2af4d329ae8f95ecb3 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Mon, 10 Apr 2023 11:36:24 +1000
Subject: [PATCH 1/9] Update README.md
- Added Donators section
---
README.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/README.md b/README.md
index e496eec..1b04984 100644
--- a/README.md
+++ b/README.md
@@ -83,3 +83,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.
+
From 19bdaf256bb298316be483774ca9ad160ff29216 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Mon, 10 Apr 2023 11:36:54 +1000
Subject: [PATCH 2/9] Update CHANGES.txt
---
CHANGES.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGES.txt b/CHANGES.txt
index 0a67c40..2471413 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
v2.0.36
- Show the options used.
+- A big 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.
From 632c0e14eed4b35f8b1bc381e56a10630242e5e2 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Mon, 10 Apr 2023 11:37:19 +1000
Subject: [PATCH 3/9] Update CHANGES.txt
---
CHANGES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 2471413..3906040 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,6 @@
v2.0.36
- Show the options used.
-- A big thank you to Gummibando on reddit for their donation.
+- 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.
From 20f41e7f4912c8221ef7d0f37fe14d9433dd0596 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Mon, 10 Apr 2023 12:29:08 +1000
Subject: [PATCH 4/9] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 1b04984..2f41fbb 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@ # Synology HDD db
+[](https://github.com/sponsors/007revad)
### Description
From 3bd5a082f844ef8ccd6fb9f3821d657f8f80e43c Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Sun, 16 Apr 2023 16:04:45 +1000
Subject: [PATCH 5/9] Update syno_hdd_db.sh
- Now edits max supported memory to match the amount of memory installed, if greater than the current max memory setting.
- Minor improvements.
---
syno_hdd_db.sh | 67 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 53 insertions(+), 14 deletions(-)
diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh
index 31c9502..088cf97 100644
--- a/syno_hdd_db.sh
+++ b/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.36"
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
From 5dea995983f9610e6be88bcbb5f22d863ac837f3 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Sun, 16 Apr 2023 16:05:19 +1000
Subject: [PATCH 6/9] Update CHANGES.txt
---
CHANGES.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGES.txt b/CHANGES.txt
index 3906040..fdac968 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+v2.1.37
+- Now edits max supported memory to match the amount of memory installed, if 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.
From edcb9cfa9397f6f4b824aa84ec8b4b02f05ce87b Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Sun, 16 Apr 2023 16:05:39 +1000
Subject: [PATCH 7/9] Update syno_hdd_db.sh
---
syno_hdd_db.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh
index 088cf97..ec9f6fd 100644
--- a/syno_hdd_db.sh
+++ b/syno_hdd_db.sh
@@ -115,7 +115,7 @@
# Optionally disable "support_disk_compatibility".
-scriptver="v2.1.36"
+scriptver="v2.1.37"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"
From 60a710bfc7c60979ee71e9cb918f9ad78e7c6327 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Sun, 16 Apr 2023 16:09:02 +1000
Subject: [PATCH 8/9] Update README.md
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 2f41fbb..9f2a5fc 100644
--- a/README.md
+++ b/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 non-Synology memory notifications.
+* 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).
From 09e7762fdbbf81bf8e7d7b3766276bfbf8d25dc8 Mon Sep 17 00:00:00 2001
From: Dave Russell <39733752+007revad@users.noreply.github.com>
Date: Sun, 16 Apr 2023 16:09:37 +1000
Subject: [PATCH 9/9] Update CHANGES.txt
---
CHANGES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index fdac968..6e9affc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,5 @@
v2.1.37
-- Now edits max supported memory to match the amount of memory installed, if greater than the current max memory setting.
+- 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