Diskstation expanding array - adding disks is slow - How to make expansion faster

Questions and mods regarding system management may go here
Forum rules
1) This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form:

https://account.synology.com/support/support_form.php?lang=enu



2) To avoid putting users' DiskStation at risk, please don't paste links to any patches provided by our Support team as we will systematically remove them. Our Support team will provide the correct patch for your DiskStation model.
User avatar
Exsosus
Trainee
Trainee
Posts: 14
Joined: Thu Oct 14, 2010 8:59 am

Re: Diskstation expanding array - adding disks is slow - How to make expansion faster

Postby Exsosus » Wed Feb 14, 2018 9:03 am

Here's a briefing for newbies with Linux commands:

#1 Log into your NAS with an SSH client. I recommend Putty which I use on Windows. Google it. For Mac here you go to here right-click, open in new tab: https://www.ssh.com/ssh/putty/mac/#sec- ... n-Mac-OS-X
#2 Click the SSH check-circle to be sure your'e connecting via SSH, this is more secure, I believe 128-bit connectivity and won't get you hacked.
#3 Input your IP adress to your NAS at the top. This is your local IP from your router at your home / office, or it is your global IP from whatsmyip.org if you have configured your NAS to be configured to from outside your home/office.
#4 Once connected you need to log in with your admin account / password. That's self-explanatory.
#5. Next you want to root-login. Input command without quotes: "sudo su -" Next, input your password for your admin account.
#6. You're now root:d. Good job so far! Let's input the command to show disk activities ongoing on your NAS. Try this: "while true; do clear; cat /proc/mdstat; sleep 1; done" Press enter.
#7. Press the keys CTRL+C to quit this current process.
#8. Type "exit" two more times, to log out.

Remember! Always lock your computer (Window key + L) , on Mac OS X 'Change user' top right next to clock when root:d and going afk. Always log out when done for the day, suggested as two good habits. SSH is difficult to hack so don't worry about staying logged in extended periods.

You're just learned a few basic steps for basic Linux commands + your Synology DSM operating system NAS. Keep learning more on your free time.

Hope I've made your day a little bit more fun.
----
Windows 10 64-bit
Ryzen 7 clocked @ 3500Mhz
32GB memory clocked @ 2900Mhz
Synology NAS solution: Synology Disk Station DS1815+ with lots of disks + in the background Synology DS411J NAS
dieter.wunderer
Trainee
Trainee
Posts: 15
Joined: Wed Oct 27, 2010 3:32 pm

Re: Diskstation expanding array - adding disks is slow - How to make expansion faster

Postby dieter.wunderer » Mon Apr 16, 2018 7:35 pm

It seems to me that all tips I found to accelerate repairing/expanding are not working anymore (DSM 6.1.6-15266 Update 1).

Setting

Code: Select all

echo 100000 > /proc/sys/dev/raid/speed_limit_min
echo 16384 > /sys/block/md2/md/stripe_cache_size

or adding this to /etc.defaults/synoinfo.conf (or /etc/synoinfo.conf)

Code: Select all

md_resync_cache_size="16384"

both changes the "stripe_cache_size" for a very short time only. The value is dropping within a minute or so to the default value 256 (for md2 in my case; other RAIDs may have different values as in my case md3 has 4096).

These are the both tips I could try, others failed completely or did not make a difference (e.g. set bitmap to internal, enable read-ahead).

So, right now, I am out of options to improve this... meaning the time it takes until I can use the larger disk is almost a week... while I have no fault tolerance!

Anyone with a solution? Please...
Thor68
Experienced
Experienced
Posts: 113
Joined: Sun Oct 09, 2011 8:09 pm
Location: Oslo, Norway

Re: Diskstation expanding array - adding disks is slow - How to make expansion faster

Postby Thor68 » Mon Apr 16, 2018 8:29 pm

Here is a little script I wrote. I usually run it interactively, but it can be run through the scheduler as well.
It takes three optional parameters, first is how big the stripe cache size should be, second is how often that value should be updated (in seconds), and the third is how often the screen should be updated (only useful when run interactively, also in seconds).
The default value for those parameters are 1024, 30 and 300. The first parameter can be any number, or "max" to make it as high as possible based on your DS' memory size.
Example:
/volume1/scripts/bin/fast-rebuild.sh max 10

Please note line 15 in the script:
RAPIDREBUILDFILE=/volume1/scripts/var/
This need to be changed to a location where the script can create a temporary file called "rapid-rebuild.running". The script will run continually until this file is deleted by you.

PS: If you run the script interactively you could cancel it by hitting Ctrl-C in your console.

Code: Select all

#!/bin/sh

##################################################################
#
# Force rapid rebuild
#
##################################################################

echo 100000 > /proc/sys/dev/raid/speed_limit_min

REFRESHINTERVAL=30
DISPINTERVAL=300
STARTTIME=$(date +%s)
DISP2=0
RAPIDREBUILDFILE=/volume1/scripts/var/


if [ "$1" = "" ]; then
  STRIPECACHESIZE=1024
elif [ "$1" = "max" ]; then
  RAMSIZE=`free -g --si | awk '/^Mem:/{print $2}'`
  if [ $RAMSIZE -ge 8 ]; then
    STRIPECACHESIZE=32768
  elif [ $RAMSIZE -ge 3 ]; then
    STRIPECACHESIZE=16384
  else
    STRIPECACHESIZE=4096
  fi
else
  STRIPECACHESIZE=$1
fi

if [ "$2" != "" ]; then
  REFRESHINTERVAL=$2
fi

if [ "$3" != "" ]; then
  DISPINTERVAL=$3
fi

touch $RAPIDREBUILDFILE/rapid-rebuild.running

echo Stripe cache size = $STRIPECACHESIZE kB
echo Refresh interval  = $REFRESHINTERVAL seconds
echo Display refresh   = $DISPINTERVAL seconds
echo ""

# Loop until killed
for (( ; ; ))
do
  if [ ! -e $RAPIDREBUILDFILE/rapid-rebuild.running ]; then
    exit 0
  fi

  for DEVID in md0 md1 md2 md3 md4 md5 md6
  do
    if [ -e /sys/block/$DEVID/md/stripe_cache_size ]; then
      echo $STRIPECACHESIZE > /sys/block/$DEVID/md/stripe_cache_size
   fi
  done

# Display status update at given intervals.
  CURTIME=$(date +%s)
  DIFFSEC=$((CURTIME - STARTTIME))
  DISP1=$((DIFFSEC / DISPINTERVAL))
  if [ $DISP1 -ge $DISP2 ]; then
    cat /proc/mdstat | grep finish
    echo `date` --- sleeping $DISPINTERVAL seconds
   ((DISP2++))
  fi

  sleep $REFRESHINTERVAL
done

exit 0

DS1815+ [16GB RAM / SHR-1 (2x10TB + 5x4TB, btrfs) / DSM 6.1.6-15266 U1] - Primary server (online since june 2016, no patch)
DS1812+ [3GB RAM / SHR-1 (mixed, btrfs) / DSM 6.1.6-15266 U1] - Backup for the 1815+
DS1511+ [3GB RAM / SHR-1 (2x2TB, ext4) / DSM 6.1.6-15266 U1] - BT Client / HDD tester/ HDD eraser

Return to “System Managment Mods”

Who is online

Users browsing this forum: No registered users and 2 guests