From f6672d4d455119a2804f087abbefbf21ea6c5393 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sun, 14 Dec 2025 13:30:28 +1100 Subject: [PATCH] Update script version to v3.6.116 Moved NVMe warning code and fixed false warnings for SHR HDD volumes with mixed drive sizes. --- syno_hdd_db.sh | 52 ++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index c0bce76..a1b891a 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -29,7 +29,7 @@ # /var/packages/StorageManager/target/ui/storage_panel.js -scriptver="v3.6.115" +scriptver="v3.6.116" script=Synology_HDD_db repo="007revad/Synology_HDD_db" scriptname=syno_hdd_db @@ -414,31 +414,6 @@ echo "Running from: ${scriptpath}/$scriptfile" #echo "scriptver: $scriptver" # debug -# Warn if script located on M.2 drive -get_script_vol() { - local script_root vol_num vg_name - script_root="${scriptpath#/*}" - script_root="${script_root%%/*}" - if [[ $script_root =~ ^volume ]] - then - vol_num="${script_root:6}" - vg_name=$(lvs --noheadings --select=lv_name="volume_$vol_num" --options=vg_name) - vg_name="${vg_name// }" - vol_name=$(pvs --noheadings --select=vg_name="$vg_name" --options=pv_name) - vol_name="${vol_name// }" - else - vol_name=$(df --output=source "/$script_root" |sed 1d) - fi -} -get_script_vol # sets $vol_name to /dev/whatever -if grep -qE "^${vol_name#/dev/} .+ nvme" /proc/mdstat -then - ding - echo -e "\n${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" - #exit 3 -fi - - cleanup_tmp(){ cleanup_err= @@ -610,6 +585,29 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | fi +# Warn if script located on M.2 drive +get_script_vol() { + local script_root vol_num vg_name + script_root="${scriptpath#/*}" + script_root="${script_root%%/*}" + if [[ $script_root =~ ^volume ]]; then + vol_num="${script_root:6}" + vg_name=$(lvs --noheadings --select=lv_name="volume_$vol_num" --options=vg_name) + vg_name="${vg_name// }" + # Only get first partition on volume group + vol_name=$(pvs --noheadings --select=vg_name="$vg_name" --options=pv_name | awk '{print $1}' | head -n 1) + else + vol_name=$(df --output=source "/$script_root" | sed 1d) # sed 1d = delete first line + fi +} +get_script_vol # sets $vol_name to /dev/whatever +if grep -qE "^${vol_name#/dev/} .+ nvme" /proc/mdstat; then + ding + echo -e "\n${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" + exit 3 +fi + + #------------------------------------------------------------------------------ # Set file variables @@ -1400,7 +1398,7 @@ check_and_merge_dupes(){ count=$(grep -Foc "$i" "$file") if [[ $count -gt 1 ]]; then - # Python 3 and 2.7 compatible HERE document + # Python 3 and 2.7 compatible HERE document python <