diff --git a/CHANGES.txt b/CHANGES.txt
index caaa414..ad0ba3b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,9 @@
+v1.0.5
+- Changed RAID-F1 references to RAID-Group.
+- Changed to reload the script after it updates itself to a new version.
+- Changed to restore settings from backup instead of replacing synoinf.conf with the backup.
+- Minor fixes and improvements.
+
v1.0.4
- Removed Restore menu choice as it was not needed.
- And was dangerous to restore synoinfo.conf from a backup in case it was made while using an older DSM version.
diff --git a/README.md b/README.md
index 4add4ba..df950f9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Synology RAID-F1 SHR switch
+# Synology RAID-Group SHR switch
@@ -6,25 +6,9 @@
### Description
-Easily switch between SHR and RAID F1
+Easily switch between SHR and RAID Group
-This script allows you to switch from SHR to RAID F1, or from RAID F1 to SHR. It backs up the synoinfo.conf first, so you can restore it later if needed.
-
-**Notes:**
-
-1. You need 3 or more SSD drives to be able to user RAID F1.
-
-2. Changing to RAID F1 disables SHR, and changing to SHR disables RAID F1.
- - I would ***not*** change from SHR to RAID F1 if you already have a storage pool containg data setup as SHR.
- - I would ***not*** change from RAID F1 to SHR if you already have a storage pool containg data setup as RAID F1.
-
-### What is RAID F1
-
-RAID F1 is Synology's RAID 5 for all flash (SSD) storage pools that tries to ensure that multiple SSD drives don't reach the end of thier life at the same time. F stands for flash, and 1 stands for 1-disk resiliency and 1-parity.
-
-See Synology's RAID F1 whitepaper
-
-Also see: Synology RAID F1: Rethinking RAID in all-Flash Environments
+This script allows you to switch from SHR to RAID Group, or from RAID Group to SHR. It backs up the synoinfo.conf first, so you can restore it later if needed.
## Download the script
@@ -48,14 +32,15 @@ sudo -i /volume1/scripts/syno_raidf1_shr_switch.sh
## Screenshots
-
Switch to RAID F1
-![](/images/raidf1_shr-switch_raidf12.png)
+Check currently set RAID type
+![](/images/raidgroup_shr-switch_check.png)
Switch to SHR
-![](/images/raidf1_shr-switch_shr.png)
+![](/images/raidgroup_shr-switch_shr.png)
+
+Switch to RAID Group
+![](/images/raidgroup_shr-switch_raidgroup.png)
Restore from the backup
-![](/images/raidf1_shr-switch_restored2.png)
+![](/images/raidgroup_shr-switch_restored.png)
-Check currently set RAID type
-![](/images/raidf1_shr-switch_check.png)
diff --git a/images/raidgroup_shr-switch_check.png b/images/raidgroup_shr-switch_check.png
new file mode 100644
index 0000000..d32a24d
Binary files /dev/null and b/images/raidgroup_shr-switch_check.png differ
diff --git a/images/raidgroup_shr-switch_raidgroup.png b/images/raidgroup_shr-switch_raidgroup.png
new file mode 100644
index 0000000..54ff346
Binary files /dev/null and b/images/raidgroup_shr-switch_raidgroup.png differ
diff --git a/images/raidgroup_shr-switch_restored.png b/images/raidgroup_shr-switch_restored.png
new file mode 100644
index 0000000..72fa431
Binary files /dev/null and b/images/raidgroup_shr-switch_restored.png differ
diff --git a/images/raidgroup_shr-switch_shr.png b/images/raidgroup_shr-switch_shr.png
new file mode 100644
index 0000000..91c6302
Binary files /dev/null and b/images/raidgroup_shr-switch_shr.png differ
diff --git a/syno_raidf1_shr_switch.sh b/syno_raidf1_shr_switch.sh
index 3856ad4..cc6675f 100644
--- a/syno_raidf1_shr_switch.sh
+++ b/syno_raidf1_shr_switch.sh
@@ -1,26 +1,26 @@
#!/usr/bin/env bash
#------------------------------------------------------------------------------
-# Enables using non-Synology NVMe drives so you can create a storage pool
-# and volume on any M.2 drive(s) entirely in DSM Storage Manager.
+# Switch between SHR and RAID Group for models that have SHR & SHR-2 disabled
#
# Github: https://github.com/007revad/Synology_RAID-F1_SHR_switch
# Script verified at https://www.shellcheck.net/
#
# To run in a shell (replace /volume1/scripts/ with path to script):
# sudo /volume1/scripts/syno_raidf1_shr_switch.sh
-#
-# https://kb.synology.com/en-ro/DSM/tutorial/Which_Synology_NAS_models_support_RAID_F1
#------------------------------------------------------------------------------
-scriptver="v1.0.4"
+scriptver="v1.0.5"
script=Synology_RAID-F1_SHR_switch
repo="007revad/Synology_RAID-F1_SHR_switch"
-# Check BASH variable is is non-empty and posix mode is off, else abort with error.
-[ "$BASH" ] && ! shopt -qo posix || {
- printf >&2 "This is a bash script, don't run it with sh\n"
+scriptshow=Synology_RAID-Group_SHR_switch
+
+# Check BASH variable is bash
+if [ ! "$(basename "$BASH")" = bash ]; then
+ echo "This is a bash script. Do not run it with $(basename "$BASH")"
+ printf \\a
exit 1
-}
+fi
#echo -e "bash version: $(bash --version | head -1 | cut -d' ' -f4)\n" # debug
@@ -39,7 +39,7 @@ Off='\e[0m' # ${Off}
usage(){
cat <&2
enabled="shr"
- elif [[ $settingshr != "yes" ]] && [[ $settingf1 == "yes" ]]; then
- echo -e "${Cyan}RAID F1${Off} ${1}enabled.\n" >&2
- enabled="raidf1"
+ elif [[ $settingshr != "yes" ]] && [[ $settingraidgrp == "yes" ]]; then
+ echo -e "${Cyan}RAID Group${Off} ${1}enabled.\n" >&2
+ enabled="raidgrp"
fi
}
@@ -293,14 +302,14 @@ fi
PS3="Select the RAID type: "
if [[ $enabled == "shr" ]]; then
- #options=("RAID F1" "Restore" "Quit")
- options=("RAID F1" "Quit")
-elif [[ $enabled == "raidf1" ]]; then
- #options=("SHR" "Restore" "Quit")
- options=("SHR" "Quit")
+ options=("RAID Group" "Restore" "Quit")
+ #options=("RAID Group" "Quit")
+elif [[ $enabled == "raidgrp" ]]; then
+ options=("SHR" "Restore" "Quit")
+ #options=("SHR" "Quit")
else
- #options=("SHR" "RAID F1" "Restore" "Quit")
- options=("SHR" "RAID F1" "Quit")
+ #options=("SHR" "RAID Group" "Restore" "Quit")
+ options=("SHR" "RAID Group" "Quit")
fi
select raid in "${options[@]}"; do
case "$raid" in
@@ -313,11 +322,11 @@ select raid in "${options[@]}"; do
break
fi
;;
- "RAID F1")
- raidf1="yes"
- echo -e "You selected ${Cyan}RAID F1${Off}"
- if [[ $enabled == "raidf1" ]]; then
- echo -e "${Cyan}RAID F1${Off} is already enabled."
+ "RAID Group")
+ raidgrp="yes"
+ echo -e "You selected ${Cyan}RAID Group${Off}"
+ if [[ $enabled == "raidgrp" ]]; then
+ echo -e "${Cyan}RAID Group${Off} is already enabled."
else
break
fi
@@ -332,7 +341,7 @@ select raid in "${options[@]}"; do
echo -e "You selected ${Cyan}Quit${Off}"
exit
;;
- *)
+ *)
echo -e "${Red}Invalid answer!${Off} Try again."
;;
esac
@@ -345,18 +354,46 @@ done
if [[ $restore == "yes" ]]; then
if [[ -f ${synoinfo}.bak ]]; then
# Restore from backup
- if cp "$synoinfo".bak "$synoinfo" ; then
- echo -e "\nSuccessfully restored from backup.\n"
- checkcurrent "is now "
- exit
+ #if cp -p "$synoinfo".bak "$synoinfo" ; then
+ # echo -e "\nSuccessfully restored from backup.\n"
+ # checkcurrent "is now "
+ # exit
+ #else
+ # echo -e "\n${Error}ERROR ${Off} Restore from backup failed!"
+ # exit 1
+ #fi
+
+ # Get default key values from backup
+ defaultsrg=$(synogetkeyvalue "$synoinfo".bak "$srg")
+ defaultsshr=$(synogetkeyvalue "$synoinfo".bak "$sshr")
+
+ # Set key values to defaults
+ if [[ $defaultsrg ]]; then
+ #echo -e "\nset support_raid_group $defaultsrg" # debug
+
+ synosetkeyvalue "$synoinfo" "$srg" "$defaultsrg"
+ else
+ #echo -e "\nset support_raid_group no" # debug
+
+ synosetkeyvalue "$synoinfo" "$srg" "no"
+ fi
+ if [[ $defaultsshr ]]; then
+ #echo "set support_syno_hybrid_raid $defaultsshr" # debug
+
+ synosetkeyvalue "$synoinfo" "$sshr" "$defaultsshr"
else
- echo -e "\n${Error}ERROR ${Off} Restore from backup failed!"
- exit 1
+ #echo "set support_syno_hybrid_raid no" # debug
+
+ synosetkeyvalue "$synoinfo" "$sshr" "no"
fi
+
+ echo
+ checkcurrent "is "
else
echo -e "\n${Error}ERROR ${Off} Backup synoinfo.conf not found!"
exit 1
fi
+ exit
fi
@@ -364,7 +401,7 @@ fi
# Backup synoinfo.conf
if [[ ! -f ${synoinfo}.bak ]]; then
- if cp "$synoinfo" "$synoinfo".bak ; then
+ if cp -p "$synoinfo" "$synoinfo".bak ; then
echo -e "\nsynoinfo.conf backed up."
else
echo -e "\n${Error}ERROR ${Off} synoinfo.conf backup failed!"
@@ -378,9 +415,9 @@ fi
#----------------------------------------------------------
# Edit synoinfo.conf
-# Enable RAID F1
-if [[ $raidf1 == "yes" ]]; then
- if [[ ! $settingf1 ]]; then
+# Enable RAID Group
+if [[ $raidgrp == "yes" ]]; then
+ if [[ ! $settingraidgrp ]]; then
# Add supportraidgroup="yes"
echo 'supportraidgroup="yes"' >> "$synoinfo"
else
@@ -394,13 +431,13 @@ if [[ $raidf1 == "yes" ]]; then
synosetkeyvalue "$synoinfo" "$sshr" no
fi
- # Check if we enabled RAID F1
+ # Check if we enabled RAID Group
settingshr="$(get_key_value $synoinfo ${sshr})"
- settingf1="$(get_key_value $synoinfo ${srg})"
- if [[ $settingshr != "yes" ]] && [[ $settingf1 == "yes" ]]; then
- echo -e "\n${Cyan}RAID F1${Off} has been enabled.\n"
+ settingraidgrp="$(get_key_value $synoinfo ${srg})"
+ if [[ $settingshr != "yes" ]] && [[ $settingraidgrp == "yes" ]]; then
+ echo -e "\n${Cyan}RAID Group${Off} has been enabled.\n"
else
- echo -e "\n${Error}ERROR${Off} Failed to enable RAID F1!"
+ echo -e "\n${Error}ERROR${Off} Failed to enable RAID Group!"
fi
fi
@@ -423,8 +460,8 @@ if [[ $shr == "yes" ]]; then
# Check if we enabled SHR
settingshr="$(get_key_value $synoinfo ${sshr})"
- settingf1="$(get_key_value $synoinfo ${srg})"
- if [[ $settingshr == "yes" ]] && [[ $settingf1 != "yes" ]]; then
+ settingraidgrp="$(get_key_value $synoinfo ${srg})"
+ if [[ $settingshr == "yes" ]] && [[ $settingraidgrp != "yes" ]]; then
echo -e "\n${Cyan}SHR${Off} has been enabled.\n"
else
echo -e "\n${Error}ERROR${Off} Failed to enable SHR!"