Browse Source

Merge pull request #552 from 007revad/develop

Develop
main v3.6.118
Dave Russell 4 weeks ago
committed by GitHub
parent
commit
00d6f61992
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      CHANGES.txt
  2. 4
      README.md
  3. 43
      syno_hdd_db.sh

5
CHANGES.txt

@ -1,3 +1,8 @@
v3.6.118
- Changed to enable creating M.2 storage pool and volume in Storage Manager after making DSM check disk compatibility. Issue #441
- Added SSD TRIM warning of possible data loss if non-Synology SSDs or NVMes are in RAID 5, 6 or SHR with more than 3 drives.
- See https://kb.synology.com/en-global/DSM/tutorial/Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list
v3.6.116
- Moved the "Warn if script located on NVMe volume" code to after the "check for new script version code. Issue #540
- Bug fix for incorrectly warning that the script is located on an NVMe volume when it is on a SHR HDD volume that has, or had, different HDD sizes. Issue #540

4
README.md

@ -38,8 +38,8 @@ #### What the script does:
* Optionally disables Western Digital Device Analytics (aka WDDA) to prevent DSM showing a [warning for WD drives that are 3 years old](https://arstechnica.com/gadgets/2023/06/clearly-predatory-western-digital-sparks-panic-anger-for-age-shaming-hdds).
* DSM 7.2.1 already has WDDA disabled.
* Makes DSM allow you to enable SSD TRIM on 3rd party SSDs and NVMes. Don't use the `-f` or --force` option if you want to enable SSD TRIM.
* Do ***NOT*** use TRIM on SSDs in RAID 5, RAID 6 or SHR with 3 or more SSDs unless you are certain your SSDs use [Method 1 mentioned here](https://kb.synology.com/en-global/DSM/tutorial/Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list).
* Enabling TRIM on SSDs that use [Method 2](https://kb.synology.com/en-global/DSM/tutorial/Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list) ***can result in data loss*** in RAID 5, RAID 6 and SHR with 3 or more drives.
* Do ***NOT*** use TRIM on SSDs in RAID 5, RAID 6 or SHR with 3 or more SSDs unless you are certain your SSDs use TRIM [Method 1 mentioned here](https://kb.synology.com/en-global/DSM/tutorial/Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list).
* Enabling TRIM on SSDs that use TRIM [Method 2](https://kb.synology.com/en-global/DSM/tutorial/Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list) ***can result in data loss*** in RAID 5, RAID 6 and SHR with 3 or more drives.
* Enables M2D20, M2D18, M2D17 and E10M20-T1 if present on Synology NAS that don't officially support them.
* Newer NAS models may also need [Synology_enable_M2_card](https://github.com/007revad/Synology_enable_M2_card)
* Checks that M.2 volume support is enabled (on models that have M.2 slots or PCIe slots).

43
syno_hdd_db.sh

@ -29,7 +29,7 @@
# /var/packages/StorageManager/target/ui/storage_panel.js
scriptver="v3.6.116"
scriptver="v3.6.118"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"
scriptname=syno_hdd_db
@ -1107,22 +1107,43 @@ m2_drive(){
fi
}
is_ssd(){
# $1 is sda, sata1 or nvme0
# Show TRIM warning if SSD or NVMe in RAID 5 or 6
if ! synodisk --isssd /dev/"$1" >/dev/null; then
# exit code 0 = is not SSD
# exit code 1 = is SSD
# Ignore Synology SSDs/NVMe drives
brand="$(cat /sys/block/"$1"/device/vendor)"
if grep -q "$1" /proc/mdstat | grep -E 'raid5|raid6'; then
if [[ $show_trim_warning != "yes" ]] && [[ $brand != "Synology" ]]; then
show_trim_warning="yes"
fi
fi
fi
}
for d in /sys/block/*; do
# $d is /sys/block/sata1 etc
case "$(basename -- "${d}")" in
sd*|hd*)
if [[ $d =~ [hs]d[a-z][a-z]?$ ]]; then
getdriveinfo "$d"
is_ssd "$d"
fi
;;
sas*)
if [[ $d =~ sas[0-9][0-9]?[0-9]?$ ]]; then
getdriveinfo "$d"
is_ssd "$d"
fi
;;
sata*)
if [[ $d =~ sata[0-9][0-9]?[0-9]?$ ]]; then
getdriveinfo "$d"
is_ssd "$d"
# In case it's a SATA M.2 SSD in device tree model NAS
# M.2 SATA drives in M2D18 or M2S17
@ -1132,11 +1153,13 @@ for d in /sys/block/*; do
nvme*)
if [[ $d =~ nvme[0-9][0-9]?n[0-9][0-9]?$ ]]; then
m2_drive "$d" "nvme"
is_ssd "$d"
fi
;;
nvc*) # M.2 SATA drives (in PCIe M2D18 or M2S17 only?)
if [[ $d =~ nvc[0-9][0-9]?$ ]]; then
m2_drive "$d" "nvc"
is_ssd "$d"
fi
;;
esac
@ -2567,6 +2590,24 @@ if [[ -f /usr/syno/sbin/synostgdisk ]]; then # DSM 6.2.3 does not have synostgd
fi
fi
# Enable creating M.2 storage pool and volume in Storage Manager # GitHub issue #441
for d in /sys/block/nvme*; do
# $d is /sys/block/nvme0n1 etc
if [[ $d =~ nvme[0-9][0-9]?n[0-9][0-9]?$ ]]; then
m2_pool_support "$d"
fi
done
# Show TRIM warning if required
if [[ $show_trim_warning == "yes" ]]; then
ding
echo -e "\n${Warning}WARNING${Off} Enabling SSD TRIM on drives in RAID 5, 6 or SHR with 3 more drives can"
echo "result in data loss if the SSD/NVMe drives marks trimmed blocks as released."
echo "SSDs that use Method 1 are okay. Do NOT enable TRIM for SSDs that use Method 2."
echo "See Why_is_SSD_TRIM_available_only_for_SSDs_in_the_compatibility_list here:"
echo "https://tinyurl.com/ssd-trim"
fi
# Show reboot message if required
if [[ $dsm -eq "6" ]] || [[ $rebootmsg == "yes" ]]; then
echo -e "\nYou may need to ${Cyan}reboot the Synology${Off} to see the changes."

Loading…
Cancel
Save