Synology NAS HDD Data Drive Auto-Hibernation
This article was last updated 287 days ago. The information within may have evolved or changed; if anything is outdated or broken, please feel free to leave a message in the comments section.
Article Abstract
Synology NAS has a defect under the default RAID1 configuration where all hard drives wake up synchronously. By initializing and installing the system with only an SSD inserted and separating the data hard drives, combined with the mdadm command to remove the data drives from the RAID array, and then using hdparm to set hibernation parameters, independent hibernation of data hard drives can be achieved. The actual operation requires executing fault marking, hibernation configuration, and script automation management via SSH, while also needing to restore the hard drives to the RAID array daily at scheduled times to synchronize system data, ultimately achieving the energy-saving goal of only having the accessed hard drive work while the remaining hard drives hibernate. This solution is suitable for scenarios where NAS power consumption needs to be reduced, and attention should be paid to the differences in state recovery after reboot between black (Xpenology) and white (genuine) Synology NAS, as well as the script execution logic.
Qwen3-14B · 2026-06-18

For Synology and QNAP, under normal circumstances, the ideal state of accessing data on a specific hard drive where only that hard drive itself works while other unrelated hard drives remain in hibernation is not possible by default. This is because, by default, both products use RAID 1 technology to write critical system data to all hard drives simultaneously, which causes all hard drives to wake up whenever there is a read or write operation. The prerequisite to solving this problem is to insert only one hard drive (preferably an SSD) when initializing the NAS, and then insert other data hard drives after the system is completely installed (this way, all apps will only be installed and run on the SSD, so at least the system operation and the functioning of these apps will no longer affect other data hard drives.

Secondly, the mdadm command is used to process the data hard drives. Because even if the system is installed on the SSD first, when data hard drives are subsequently added to the NAS, Synology and QNAP will still add multiple RAID1 arrays to these drives to store some critical data. Therefore, to hibernate in an ideal state, each data hard drive needs to be removed from the RAID1 arrays. However, due to security considerations, it is also necessary to briefly add the hard drives back to each RAID1 array daily to synchronize data. See the actual steps below for specific details.

Note: This article only covers Synology. For QNAP's setup method, some bloggers have already written very detailed tutorials online, which you can search for yourself.

First, log in to the Synology system via SSH. I don't need to explain how to SSH in detail, right...

After SSHing, switch to the root user

sudo -i

Use the command

cat /proc/mdstat

to check how many mds (md is RAID1) there are and which hard drives are used. The image below shows my Xpenology (black Synology) NAS:

image.png

There are 4 RAID arrays here: md0, md1, md2, md3, among which md0 and md1 use all hard drives, while md3 only uses 4 mechanical hard drives. md2 corresponds to the disk where the system is located. Since we previously recommended inserting only the SSD during initialization, there is only sdf3 here.

Note: In this article, sdf is the SSD solid-state drive, and 3 represents the 3rd partition of this SSD.

First, check md0 and md1, which are similar to md9 and md13 on QNAP.

mdadm -D /dev/md0

image.png

As can be seen from the figure above, md0 contains 4 data hard drives, namely sda, sdb, sdc, and sdd, plus sdf1. Here, 1 is the partition number of each hard drive in this md, and the same applies below.

mdadm -D /dev/md1

image.png

md1 also contains 4 data hard drives, namely sda2, sdb2, sdc2, and sdd2, plus sdf2.

mdadm -D /dev/md3

image.png

md3 only contains 4 data hard drives, namely sda, sdb, sdc, and sdd. Therefore, our next goal is also clear, which is md0 and md1. Because these 2 RAID arrays contain both data drives and the system SSD, any system read/write operation will inevitably wake up the 4 data drives. Stripping the 4 data drives from md0 and md1 is what we need to do next. However, for your respective Synology systems, how do you distinguish which are SSDs and which are HDD data drives? (Why do I say HDD data drives? Rich people using SSDs as data drives would directly ask, why hibernate?) Use theparted /dev/sd(#) printcommand to find out which are HDD data drives and which are SSDs. To achieve the ideal method we mentioned earlier, why do we need to install the system only on the SSD? Because the drive where the system is installed must run constantly and cannot hibernate. All others are HDD data drives that need to hibernate, so making a clear distinction is a prerequisite.

parted /dev/sdf print

parted /dev/sda print


You can see that my sdf is the system SSD, and the others (a, d, c, b) are HDD drives, which are our targets. Let's start the operation. Use the following commands to set the corresponding partitions of sda1, sdb1, sdc1, and sdd1 in md0 to fail:

mdadm /dev/md0 -f /dev/sda1
mdadm /dev/md0 -f /dev/sdb1
mdadm /dev/md0 -f /dev/sdc1
mdadm /dev/md0 -f /dev/sdd1

mdadm /dev/md0 -f /dev/sdb1

mdadm -D /dev/md0

image.png

mdadm /dev/md0 -f /dev/sdc1

mdadm /dev/md1 -f /dev/sda2
mdadm /dev/md1 -f /dev/sdb2
mdadm /dev/md1 -f /dev/sdc2
mdadm /dev/md1 -f /dev/sdd2

mdadm /dev/md0 -f /dev/sdb1

mdadm -D /dev/md1

image.png

Then run again

As seen from the figure above, after running the command, the states of sda1, sdb1, sdc1, and sdd1 are all displayed as faulty. Similarly, perform the same operation on sda2, sdb2, sdc2, and sdd2 of md1:

hdparm -S 120 /dev/sda
hdparm -S 120 /dev/sdb
hdparm -S 120 /dev/sdc
hdparm -S 120 /dev/sdd

mdadm /dev/md1 -f /dev/sdb2


mdadm /dev/md1 -f /dev/sdc2

hdparm -C /dev/sda | grep state


After running the command, the states of sda2, sdb2, sdc2, and sdd2 are also displayed as faulty.

Next, set a 10-minute hibernation for each of the 4 hard drives:

hdparm -S 120 /dev/sda

hdparm -S 120 /dev/sdb

vim /volume1/@userpreference/admin/rebulid_md.sh

hdparm -S 120 /dev/sdd

#!/bin/bash 
echo Re-adding md0
mdadm /dev/md0 --re-add /dev/sda1
mdadm /dev/md0 --re-add /dev/sdb1
mdadm /dev/md0 --re-add /dev/sdc1
mdadm /dev/md0 --re-add /dev/sdd1
echo Re-adding md1 
mdadm /dev/md1 --re-add /dev/sda2
mdadm /dev/md1 --re-add /dev/sdb2
mdadm /dev/md1 --re-add /dev/sdc2
mdadm /dev/md1 --re-add /dev/sdd2
vim /volume1/@userpreference/admin/disconnect_md.sh

hdparm -C /dev/sda | grep state

#!/bin/bash 
echo Disconnecting md0
mdadm /dev/md0 --fail /dev/sda1
mdadm /dev/md0 --fail /dev/sdb1
mdadm /dev/md0 --fail /dev/sdc1
mdadm /dev/md0 --fail /dev/sdd1
echo Disconnecting md1
mdadm /dev/md1 --fail /dev/sda2
mdadm /dev/md1 --fail /dev/sdb2
mdadm /dev/md1 --fail /dev/sdc2
mdadm /dev/md1 --fail /dev/sdd2
vim /volume1/@userpreference/admin/hdd_sleep.sh

hdparm -C /dev/sda | grep state

hdparm -S 120 /dev/sda
hdparm -S 120 /dev/sdb
hdparm -S 120 /dev/sdc
hdparm -S 120 /dev/sdd

mdadm /dev/md0 --fail /dev/sda1

chmod +x /volume1/@userpreference/admin/rebulid_md.sh
chmod +x /volume1/@userpreference/admin/disconnect_md.sh
chmod +x /volume1/@userpreference/admin/hdd_sleep.sh

mdadm /dev/md0 --fail /dev/sdc1

202309062109593.png

202309062111280.png

202309062112035.png

image.png

mdadm /dev/md0 --fail /dev/sdd1

202309062114271.png

202309062115309.png

202309062116330.png

echo Disconnecting md1

202309062117975.png
202309062117636.png

mdadm /dev/md1 --fail /dev/sda2

View Related Categories · 3 Matches
📌 Content Structure Prompt:
This content is part of the following knowledge map, where you can view the complete content path: Blog Knowledge Map。
📎 Related Articles
Share this article
The blog content is original, please indicate the source when reposting! The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if needed, you can join theTelegram Groupto discuss questions together.

Comments

  1. Nosferatu
    Macintosh Chrome 131.0.0.0
    2 years ago
    2025-1-09 2:02:30

    Following the steps was a complete success. Daily standby for 12 disks is 140w, and after hibernation, the power drops to 75w. The key is that hibernation can greatly reduce the burden on the hard drives. Thank you, OP, for your selfless sharing! This is the most detailed and clearest tutorial on the entire internet. Although there is a tiny flaw, which is the warning about being unable to access the system partition, I feel Synology's thinking is very rigid. They could completely learn from TrueNAS and set up the system disk separately, or leave the choice of the boot partition to the user. Enterprise-grade products actually care quite a bit about electricity bills, right?
    p.s. The sleep script seems to need to be run by the root user as well; the admin user doesn't seem to be able to run it.

    • Owner
      Nosferatu
      Macintosh Chrome 131.0.0.0
      2 years ago
      2025-1-09 9:45:46

      Yes, it definitely needs root. However, although I wrote this based on XPEnology, I actually use QNAP (and did similar processing). After messing around with XPEnology for a long time, it turns out it's basically useless now~.

      • Nosferatu
        Tang Wudi
        Windows Chrome 131.0.0.0
        2 years ago
        2025-1-09 10:58:01

        There is also a small issue, I don't know if you have encountered it. My machine always automatically wakes up in the background. That is, hibernation succeeds, but it doesn't last long before waking up.

        • Owner
          Nosferatu
          Macintosh Chrome 131.0.0.0
          2 years ago
          2025-1-09 11:03:01

          When you first installed the system, did you only plug in the system disk to install? I remember the article mentioned that if you installed the system with all disks plugged in, it is equivalent to having system code on every disk, and it will definitely wake up automatically at every turn.

          • Nosferatu
            Tang Wudi
            Windows Chrome 131.0.0.0
            2 years ago
            2025-1-09 11:06:46

            I didn't plug in the HDD during installation, just plugged in the new HDD yesterday. When installing the system, there were just two virtual hard drives, which puzzles me. Now that I'm at work, I can't log into SSH. I'll check the wakeup logs in detail when I get back.

          • Nosferatu
            Nosferatu
            Macintosh Chrome 131.0.0.0
            2 years ago
            2025-1-09 18:55:46

            Hey expert, another small question. Why is it that as soon as I execute the rebuild_md.sh script now, it prompts:
            bash /volume1/@userpreference/admin/rebulid_md.sh
            Re-adding md0
            mdadm: –re-add for /dev/sata1p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata2p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata3p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata4p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata5p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata6p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata7p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata8p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata9p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata10p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata11p1 to /dev/md0 is not possible
            mdadm: –re-add for /dev/sata12p1 to /dev/md0 is not possible
            Re-adding md1
            mdadm: –re-add for /dev/sata1p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata2p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata3p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata4p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata5p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata6p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata7p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata8p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata9p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata10p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata11p2 to /dev/md1 is not possible
            mdadm: –re-add for /dev/sata12p2 to /dev/md1 is not possible
            All of them are not possible. Permissions have been set, and yet this system partition can be restored by clicking repair in the system. Has the system been secretly modified?

          • Owner
            Nosferatu
            Macintosh Chrome 131.0.0.0
            2 years ago
            2025-1-10 11:38:49

            bash /volume1/@userpreference/admin/rebulid_md.sh

          • Nosferatu
            Tang Wudi
            Windows Chrome 131.0.0.0
            2 years ago
            2025-1-10 16:06:47

            mdadm: --re-add for /dev/sata1p1 to /dev/md0 is not possible cat /proc/mdstat mdadm: --re-add for /dev/sata2p1 to /dev/md0 is not possible

  2. mdadm: --re-add for /dev/sata4p1 to /dev/md0 is not possible
    Android Chrome 126.0.0.0
    2 years ago
    2024-7-31 13:56:36

    mdadm: --re-add for /dev/sata5p1 to /dev/md0 is not possible

    • Owner
      mdadm: --re-add for /dev/sata4p1 to /dev/md0 is not possible
      Macintosh Chrome 127.0.0.0
      2 years ago
      2024-8-02 21:43:17

      mdadm: --re-add for /dev/sata6p1 to /dev/md0 is not possible

  3. mdadm: --re-add for /dev/sata7p1 to /dev/md0 is not possible
    Windows To be honest, this article was more troublesome than I imagined. It seemed very simple at first, but I kept running into problems during implementation (too many prerequisite knowledge points). In the final analysis, it was caused by my poor foundation and narrow scope of knowledge. My understanding of many knowledge points was very superficial, and I only realized how tough it was when I actually had to use them, forcing me to quiet my mind and carefully study the details.
    2 years ago
    2024-5-04 0:17:44

    mdadm: --re-add for /dev/sata8p1 to /dev/md0 is not possible

    • Owner
      mdadm: --re-add for /dev/sata7p1 to /dev/md0 is not possible
      Macintosh To be honest, this article was more troublesome than I imagined. It seemed very simple at first, but I kept running into problems during implementation (too many prerequisite knowledge points). In the final analysis, it was caused by my poor foundation and narrow scope of knowledge. My understanding of many knowledge points was very superficial, and I only realized how tough it was when I actually had to use them, forcing me to quiet my mind and carefully study the details.
      2 years ago
      2024-5-04 8:43:14

      mdadm: --re-add for /dev/sata9p1 to /dev/md0 is not possible

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗ
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Kaomoji
Emoji
Little Dinosaur
Flower!
Previous
Next
       

👋 Welcome to “Wudi's Personal Blog”

Here, long-term exploration is mainly carried out around the following directions:

🧱 Personal Digital Infrastructure and Blog System Construction
☁️ Cloudflare and Network Architecture Practice
🧠 AI and Knowledge System Exploration
🛡️ Network Security and Access Optimization
🎵 Music and Sound Cognition
👁️ Cognitive Perspectives and Worldviews