Last edited:
I own 2 Synology devices for many years and have done raid rebuilds or expansion numberous times. Unfortunately the Synology GUI reports progress on only the current MD device in progress. When it finishes that MD device and advances to the next, the progress resets back to 0%. It can frustrating to wait and think the entire process is about the complete only to see the progress indicator go back to 0%.
I don't recall where I originally read this next tidbit I'm about to share, but I found it quite helpful. The idea is to log into your device and access the terminal. From the shell, one can then run some basic command(s) to get more information about the rebuild or expansion in progress. Since the Synology has a limited set of shell commands to run, it can be little tricky to construct a command line which provides useful output. I created a command line and have enhanced it over the years that I would like to share with anyone who would like more info about the rebuild/expansion of their device(s).
To get to the terminal/shell, you need to log in as follows: To ssh in:
- "ssh admin@IP", pswd "YourAdminPassword"
- "sudo su root -", pswd "YourAdminPassword"
Once logged in, then copy and paste this very long command line into the terminal/shell window:
- t1=0; t=0; for i in $(seq 1 100000); do h=$(($t/3600)); s=$(($t%3600)); m=$(($s/60)); if [ $m -lt 10 ]; then m=0$m; fi; s=$(($s%60)); if [ $s -lt 10 ]; then s=0$s; fi; for k in $(ls -d /sys/block/md*); do mdnum="${k/*md}"; stat=$(cat /proc/mdstat | sed -n "/^md$mdnum/,/^\s*$/p" | grep speed); if [[ $stat ]]; then if [[ $t1 -eq 0 ]]; then t1=$(date +%s); fi; d=$(date -d \@$t1 "+%Y-%m-%d/%T"); echo "$d $h:$m:$s md$mdnum:$stat"; scs="$k/md/stripe_cache_size"; if [ -e $scs ]; then $(echo 16384 > $scs); fi; break; fi; done; t2=$(date +%s); sleep $((30-$(($t2-$t1)))); let t=t+30; let t1=t1+30; done
This command line will report:
"Current Date/Time, Elapsed time, MD#, progress bar, operation (ie recovery/reshape), %progress for current MD#, MD# (completed/total bytes), ETA of the current MD# to finish and the operation speed.
The output looks similar to this:
2021-08-02/13:37:29 22:30:00 md8: [====>................] reshape = 24.3% (951929340/3906982848) finish=778.0min speed=63299K/sec
In addition to reporting more detailed progress, this script also tweaks the MD# stripe_cache_size to 16384, which under all circumstance I've seen, has always improved the operational speed, sometimes quite significantly.
Note: Bear in mind the ETA will fluctuate if the operation speed changes. Its best to limit any other activity to the device to maintain higher operation speeds.
Hope you find this useful!
Also, as I've tweaked and enhanced this command line countless times, I'm always looking for further improvements. Feel free to suggest/recommend changes.
I don't recall where I originally read this next tidbit I'm about to share, but I found it quite helpful. The idea is to log into your device and access the terminal. From the shell, one can then run some basic command(s) to get more information about the rebuild or expansion in progress. Since the Synology has a limited set of shell commands to run, it can be little tricky to construct a command line which provides useful output. I created a command line and have enhanced it over the years that I would like to share with anyone who would like more info about the rebuild/expansion of their device(s).
To get to the terminal/shell, you need to log in as follows: To ssh in:
- "ssh admin@IP", pswd "YourAdminPassword"
- "sudo su root -", pswd "YourAdminPassword"
Once logged in, then copy and paste this very long command line into the terminal/shell window:
- t1=0; t=0; for i in $(seq 1 100000); do h=$(($t/3600)); s=$(($t%3600)); m=$(($s/60)); if [ $m -lt 10 ]; then m=0$m; fi; s=$(($s%60)); if [ $s -lt 10 ]; then s=0$s; fi; for k in $(ls -d /sys/block/md*); do mdnum="${k/*md}"; stat=$(cat /proc/mdstat | sed -n "/^md$mdnum/,/^\s*$/p" | grep speed); if [[ $stat ]]; then if [[ $t1 -eq 0 ]]; then t1=$(date +%s); fi; d=$(date -d \@$t1 "+%Y-%m-%d/%T"); echo "$d $h:$m:$s md$mdnum:$stat"; scs="$k/md/stripe_cache_size"; if [ -e $scs ]; then $(echo 16384 > $scs); fi; break; fi; done; t2=$(date +%s); sleep $((30-$(($t2-$t1)))); let t=t+30; let t1=t1+30; done
This command line will report:
"Current Date/Time, Elapsed time, MD#, progress bar, operation (ie recovery/reshape), %progress for current MD#, MD# (completed/total bytes), ETA of the current MD# to finish and the operation speed.
The output looks similar to this:
2021-08-02/13:37:29 22:30:00 md8: [====>................] reshape = 24.3% (951929340/3906982848) finish=778.0min speed=63299K/sec
In addition to reporting more detailed progress, this script also tweaks the MD# stripe_cache_size to 16384, which under all circumstance I've seen, has always improved the operational speed, sometimes quite significantly.
Note: Bear in mind the ETA will fluctuate if the operation speed changes. Its best to limit any other activity to the device to maintain higher operation speeds.
Hope you find this useful!
Also, as I've tweaked and enhanced this command line countless times, I'm always looking for further improvements. Feel free to suggest/recommend changes.