Speed up Synology SHR Raid repair.

Rebuilding SHR arrays can take a long long time.
But we can solve this by the might SSH / CLI.

SSH into your DiskStation. To view the status of your rebuild:

$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md2 : active raid5 sdd5[6] sda5[5] sde5[7] sdc5[2] sdb5[1]
      7795118592 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/4] [UUU_U]
      [=>...................]  recovery =  5.2% (103271424/1948779648) finish=672.9min speed=45708K/sec

Initially, the rebuild speed is 45708 Kb/sec (~45 Mb/sec), with an estimated completion time of 670 minutes, or 11 hours so so.

We can go faster!

RAID rebuilds are speed limited. The default minimum and maximum speeds are, in Kb/sec:

$ cat /proc/sys/dev/raid/speed_limit_max # maximum speed
200000
$ cat /proc/sys/dev/raid/speed_limit_min
1000

Let’s increase that minimum speed a touch:

$ sudo su
# echo 50000 > /proc/sys/dev/raid/speed_limit_min

And see if we’re going any faster:

# cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md2 : active raid5 sdd5[6] sda5[5] sde5[7] sdc5[2] sdb5[1]
      7795118592 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/4] [UUU_U]
      [=>...................]  recovery =  7.3% (142689152/1948779648) finish=543.4min speed=55388K/sec

Yeah, it’s a little faster – up to 55 Mb/sec with an estimated completion two hours sooner.

# echo 100000 > /proc/sys/dev/raid/speed_limit_min
# cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md2 : active raid5 sdd5[6] sda5[5] sde5[7] sdc5[2] sdb5[1]
      7795118592 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/4] [UUU_U]
      [=>...................]  recovery =  8.4% (163878932/1948779648) finish=356.4min speed=83448K/sec

I played around, and with a speed_limit_min value of 100000, we hit a bottleneck and max out at about 85 Mb/sec, but thats pretty much twice as fast as we were going. Not bad. (Note to self: return to default value when the rebuild is finish.

Diskcleanup on 2008 R2

Have you ever found yourself missing the “disk cleanup”  tool to clean a server or of its much needed C:\ space. Wait no longer..

First stop could be, to install the Windows Desktop Experience feature, but this requires a reboot and will install also other application, you might not want..

So how about, if you could just copy 2 files and run the application.

 

Operating System Architecture File Location
Windows Server 2008 R2 64-bit C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
Windows Server 2008 R2 64-bit C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui
Windows Server 2008 64-bit C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui
Windows Server 2008 64-bit C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe.mui
Windows Server 2008 32-bit C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui
Windows Server 2008 32-bit C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe

Once you’ve located the files move them to the following locations:

  1. Cleanmgr.exe should go in %systemroot%\System32.
  2. Cleanmgr.exe.mui should go in %systemroot%\System32\en-US.

You can now launch the Disk cleanup tool by running Cleanmgr.exe from the command prompt.

 

Sources:
Windows KB page

Installing MemCached

Memcached is a high performance in-memory caching system that can be used to speed up applications and websites that use databases. Memcached does not write to disk, instead store its content in system memory which makes it faster.

Majority of the content management systems in used today have tools to take advantage of Memcached. If configured correctly, you may be able to see huge improvements to your websites and applications.

This brief tutorial shows you how to install Memcached on Ubuntu 17.04 / 17.10 servers

Continue reading Installing MemCached

Updating Ubuntu servers

One of the most effective ways to protect your servers is by updating them regularly. These updates and patches are released to fix security vulnerabilities, enhance performance and resolve issues.

The process of updating Ubuntu is fairly simple. All one needs is administrative access to the server terminal usually via SSH or other means.

Advanced Packaging Tool (APT) is a powerful command line tool which works with Ubuntu. It’s the default package management and installation tool for Ubuntu and other distributions.

Checking For Updates On Ubuntu Servers

To check for updated software that are available for Ubuntu server, run the commands below.

sudo apt-get update && apt-get -s upgrade

The command above will is all or any upgradable packages to choose from and give you the option to upgrade a single package or all the packages on the system.

Updating Ubuntu Packages

A single command s used to update all Ubuntu install packages. That command is shown below:

sudo apt-get update

You can also run the commands below to update as well as upgrade Ubuntu packages at the same time.

sudo apt-get update && sudo apt-get dist-upgrade

When you run the above commands, you’ll be prompted to confirm the update. You can then type Y for yes and press Enter to continue with the updates. Depending on the size of the update and your Internet connection speed, it may take few minutes to an hour.

After all the packages are downloaded and installed,  you can continue working and knowing that you server is updated and protected.