2

This is my first question here; after extensive research I had to reach out for help.

I’ve build a home server based on Arch Linux. It basically has two main purposes: running a Plex Media Server and serve some AFP shares for Time Machine backups and remote media organisation. Everything works fine and I’m very pleased with the performance. Aside from Avahi, Netatalk and PMS there are not many processes running. I could leave it at this, but there is a little thing bothering me – power management:

What I like to accomplish is, save some power and give my hard drives some rest when not in use. There are 8 WD Red 4TB disks in a Raid5 configuration using BTRFS as file system (data and metadata both are Raid5). There are no system files or log files saved on the disk array; these are on a separate SSD. There are only two shares, media and timemachine. So no system related process should interrupt the disks from sleeping.

What I’ve done so far:

hdparm

  • See if the disks can spin down using –y option ✓
  • See if APM is supported -> disks handle it themselves ✓

systemd

  • Write a little service to set HDD spin down after system has booted ✓
  • Check if executed correctly using status command ✓

Everything seams to be okay for the disks to spin down, but they just won’t go into standby mode. When forcing all disks into standby and try to read a file from a share afterwards, the disks start spin up as expected, BUT the system freezes and gets irresponsive …

I’m not sure what causes this behaviour: Is BTRFS not suited for HDD standby? Does the wake up time take too long, as each disk spins up after the other?

My goal is: I want to set my drives into standby after 2h and spin them up ALL AT ONCE when a file gets accessed on the BTRFS Raid. Can someone please help me?!

Many thanks in advance


Update

There is some progress to report on this issue and I thought it might be of interest to someone.

I was able to locate the main cause of the frequent system freezes. Fortunately it had nothing to do with BTRFS. Because the eight drives don't spin up all together, they need more than the default 30 seconds timeout specified under /sys/block/sda/device/timeout. This causes kernel errors and can even hang up the whole system. Ether the driver or the kernel is having issues with the drives slow spin up time. Btw my Adaptec HBA 1000 8i controller uses the aacraid driver.

Setting the timeout value of /sys/block/sd[x]/device/timeout to 120 solves the problem. The drives even go to sleep now. More can be read here: http://ask.adaptec.com/app/answers/detail/a_id/15357/~/error%3A-aacraid%3A-host-adapter-abort-request

But a new problem occurs. Now that the drives go to sleep, some processes can't access the filesystem quick enough. This is what I get: INFO: task xyz blocked for more than 120 seconds. Is that bad?

What’s now left to figure out is how to get all eight drives to spin up at once. There should not be any issues with power draw, because when rebooting the machine, all drives spin up at once too and the PSU seams to handle that just fine. Also I would like to know what causes the new error messages.

Again thanks for any inputs!


Update 2

After further observation and testing it seams as if the problem with the aacraid: Host adapter abort request messages is still around. Although the system did not freeze anymore since setting the timeout value to 120 the kernel log is still filled with these requests. From time to time I see entries like this: INFO: task btrfs-transacti:1351 blocked for more than 120 seconds. From what I can tell both issues only occur when the drives are in standby mode. This could mean that the main cause of all the above problems is related to the irresponsiveness of the drives when in standby.

I also noticed that the drives capacities hop between 0 and 4000787030016. The entry reads sd(x): detected capacity change from 0 to 4000787030016’ and sd(x): detected capacity change from 4000787030016 to 0’. I’m uncertain if this also has something to do with the drives power state. It’s very strange though.

Since I’ve tried out many suggestions I could find on the Internet and still don’t get things to work normally, I was thinking about changing the storage controller. From what I have read, the LSI controllers are very well supported under Linux. Is that true? Does anyone have experience with a LSI SAS 9217-8i for example? It would be great to get some feedback on how this controller works with BTRFS and the HDD standby mode. I have great hope that a new controller might help.

Many thanks for your thoughts on this.

  • I do not know the answer but one this is not clear in the question that i'd like to point out: when you say that you force the disks into standby mode you mean that hdparm -y is run against each disk, right? – grochmal Jul 21 '16 at 15:59
  • Yes exactly, I use hdparm -y /dev/sd[abcdefgh] to put all drives into standby. – user180820 Jul 21 '16 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.