• Contact
  • Cookie Policy
  • Helpdesk
Techspark Blogging about technical stuff

Monthly Archives: July 2024

You are browsing the site archives by month.

Speed-Up/Tune Synology DSM with HDD & SSD

July 7, 2024 8:35 PM / Leave a Comment / XeroX

Did you know the operating system of your Synology named DSM is split in a RAID1 on all attached drives? In RAID1 data is read from all drives but what if we can get those jucy short access times from an attached SSD?

Synology structures the system in the following manner:
/dev/md0 – Operating System
/dev/md1 – Swap Space
/dev/mdx – Your Volumes/Storage Pools

To view your current layout you have to logon via SSH and become root (sudo -i). Running ‘cat /proc/mdstat’ shows the following output:

Personalities : [raid1] [raid6] [raid5] [raid4] [raidF1]
md2 : active raid5 sda5[0] sdd5[3] sdc5[4] sdb5[1]
      XX blocks super 1.2 level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

md3 : active raid1 sdf5[0]
      XX blocks super 1.2 [1/1] [U]

md1 : active raid1 sda2[0] sdf2[4] sdb2[3] sdc2[2] sdd2[1]
      XX blocks [5/5] [UUUUU]

md0 : active raid1 sda1[0] sdf1[4] sdb1[3] sdc1[2] sdd1[1]
      XX blocks [5/5] [UUUUU]

In my case you can see four raidsets. DSM, Swap, Volume 1 and Volume 2. However one of those drives is a SSD (sdf) and as you can see part of md0 and md1.

mdadm (casual linux software raid) allows you to configure a RAID with the attribute ‘writemostly’.

This is valid for RAID1 only and means that the ‘md’ driver will avoid reading from these devices if at all possible. This can be useful if mirroring over a slow link.

Source: https://linux.die.net/man/8/mdadm

Writemostly means, please only write to this drive and don’t try to read. You can achieve that by flagging all rotational drives on md0 (DSM) and md1 (Swap Space) with ‘writemostly’. In my case sda, sdb, sdc and sdd, as sdf is the SSD. We can achieve that with running the following command for each drive in each raidset:

echo writemostly > /sys/block/md0/md/dev-sda1/state
echo writemostly > /sys/block/md0/md/dev-sdb1/state
echo writemostly > /sys/block/md0/md/dev-sdc1/state
echo writemostly > /sys/block/md0/md/dev-sdd1/state

echo writemostly > /sys/block/md1/md/dev-sda2/state
echo writemostly > /sys/block/md1/md/dev-sdb2/state
echo writemostly > /sys/block/md1/md/dev-sdc2/state
echo writemostly > /sys/block/md1/md/dev-sdd2/state

Why is it sda1 and sda2? sda is the physical drive and sda1 is the first partition, sda2 the second and so on. After you did that you will the the following out put of ‘cat /proc/mdstat’:

Personalities : [raid1] [raid6] [raid5] [raid4] [raidF1]
md2 : active raid5 sda5[0] sdd5[3] sdc5[4] sdb5[1]
      XX blocks super 1.2 level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

md3 : active raid1 sdf5[0]
      XX blocks super 1.2 [1/1] [U]

md1 : active raid1 sda2[0](W) sdf2[4] sdb2[3](W) sdc2[2](W) sdd2[1](W)
      XX blocks [5/5] [UUUUU]

md0 : active raid1 sda1[0](W) sdf1[4] sdb1[3](W) sdc1[2](W) sdd1[1](W)
      XX blocks [5/5] [UUUUU]

Saw the (W) after all rotational drives? This shows that mdadm will only try to do write operations on those drives and no reads.

After a restart you can verify your startup times with ‘cat /var/log/synobootup.log’:
Startup finished in 13.354s (kernel) + 2min 46.683s (userspace) = 3min 38ms.

You can do additional verification by running ‘mdadm -D /dev/md0’. -D for detail.

/dev/md0:
        Version : 0.90
  Creation Time : Fri Jul 20 15:51:28 2018
     Raid Level : raid1
     Array Size : XX (XX GiB XX GB)
  Used Dev Size : XX (XX GiB XX GB)
   Raid Devices : 5
  Total Devices : 5
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Sun Jul  7 21:17:33 2024
          State : clean
 Active Devices : 5
Working Devices : 5
 Failed Devices : 0
  Spare Devices : 0

           UUID xxxxxxxx:xxxxxxxx:xxxxxxxx:xxxxxxxx:xxxxxxxx
         Events : 0

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync writemostly   /dev/sda1
       1       8       49        1      active sync writemostly   /dev/sdd1
       2       8       33        2      active sync writemostly   /dev/sdc1
       3       8       17        3      active sync writemostly   /dev/sdb1
       4       8       81        4      active sync   /dev/sdf1

You will see here the ‘writemostly’ flag on all rotational drives. You can always return to the previous state with the following command for each drive:

echo -writemostly > /sys/block/mdX/md/dev-sdX1/state

The result is Synology DSM “mostly” reads from your SSD. “Mostly” because it will start to read from rotational drives again if your SSD(s) fail.

Cheers

Posted in: Synology / Tagged: mdadm, Synology

Support This Site

If you like this content, you can buy me a coffee

Recent Posts

  • Super Famicom/Super Nintendo xBAND XBⱯND – Teardown
  • Gigabyte ITE IT5701/ 5702 Firmware Archive
  • Speed-Up/Tune Synology DSM with HDD & SSD
  • Dreamcast – Skies of Arcadia – PAL – 60Hz – VGA Patch
  • Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense

Recent Comments

  • Raoul on Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense
  • XeroX on Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense
  • Raoul on Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense
  • Raoul on Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense
  • XeroX on Running Sierra Wireless EM7455 on FreeBSD/OPNSense/pfSense

Archives

  • January 2025
  • July 2024
  • October 2023
  • February 2023
  • November 2022
  • September 2022
  • September 2021
  • August 2021
  • November 2020
  • November 2015
  • June 2015
  • February 2015
  • August 2014
  • June 2014
  • March 2014
  • February 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013

Categories

  • ESXi
  • FreeBSD
  • Hardware
  • Hyper-V
  • iOS
  • Microsoft
  • Nintendo
  • OfficeWebApps
  • Operations Manager
  • Retro
  • SharePoint
  • Synology
  • Teardown
  • vCenter
  • VMWare
  • Webserver
  • Windows Server
© Copyright 2025 - Techspark
Infinity Theme by DesignCoral / WordPress