Linux - prevent disks spinning up

3

2

On bootup all disks are spun up, but 4 are just backup (and pretty noisy too). Soo I'd rather prefer to never ever spin them up at all when booting.

Is there a kernel option which tells the kernel which SATA port the disk is attached which contains the rootfs?

How can I achieve disks not spinning up on boot?

drahnr

Posted 2013-08-23T19:55:47.483

Reputation: 300

Did you figured out, how to non-destructively test, if the HDD & Motherboard support the hddparm -s command? – Adam Ryczkowski – 2014-02-12T09:50:42.750

I did not have much time yet nor enough disk space to backup everything properly. So this is postponed to early march. For the meantime I did set the disk spin down time to something close to a 1 minute - but this is just a temporary fix. – drahnr – 2014-02-17T20:51:11.327

Answers

4

I am not sure how the first sentence relates the last one. Maybe you could enhance your question. So assuming the first sentence is the actual question, I may point you in the right direction.

What you are looking for is called Power-up in Standby or PUIS for short. This feature has to be supported by your BIOS/UEFI, hard drive and the kernel. Some hard drives, for example certain models from Western Digital, are equipped with a special jumper to enable this feature. (Western Digital calls this feature PM2). On other drives this feature can be enables by using hdparm. The command below should only be run when you are absolutely sure your platform supports PUIS. This command could potentially make a disk undetectable by even your BIOS! I recommend you to read the man page for more information.

CAUTION hdparm -s 1 /dev/sdX CAUTION (Note the -s option is lower case.)

I did not implement this feature yet on my own server. Currently I am just examining all pros and cons. I have read somewhere that you have to remove the drive from /etc/fstab as well. Else the mount command will spin up the drive. However I can not confirm this yet.

Alain

Posted 2013-08-23T19:55:47.483

Reputation: 56

1As for the last part, it should be enough to just mark the entry noauto. – a CVn – 2013-10-11T07:47:30.463

My motherboard is ASUS Z87-PLUS (how to find out? EFI is really spars, and the website from ASUS is useless http://www.asus.com/Motherboards/Z87PLUS/ ), Linux kernel should support it right (as long my root does live on another hard disk) , hard drives (WD20EARX-00PASB0, SAMSUNG HD103SJ) at least the first should support it (according to hdparm -l /dev/sdf). Are you sure the EFI has to support it?

– drahnr – 2013-10-13T11:29:01.637

3

Also assuming that the title and the first half of the question is your actual question, there's more magic to be done through hdparm. If you can live with the disks spinning up and then shutting down, you can use hdparm to instruct the disk to spin down after a short period of inactivity. This is done through its -S (upper case S) parameter.

Setting a spindown timeout means the disk still spins up normally during the power-on, but then spins down at some reasonably determinate time thereafter. This is usually safer than setting the disk to power up in standby.

Note that, as stated in the man page:

The encoding of the timeout value is somewhat peculiar. A value of zero means "timeouts are disabled": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.

Hence, if you want to spin down the disk /dev/sdb and sets its idle spindown time to one minute, you'd use:

sudo hdparm -S12 /dev/sdb

You could add such hdparm commands to a late boot script like /etc/init.d/rc.local, or your distribution may offer a specific init script configuration file to do it. For example, on Debian, you'd edit /etc/hdparm.conf to include:

/dev/sdb {
    spindown_time = 12
}

I would suggest using an appropriate name from one of the /dev/disk/by-* directories (/dev/disk/by-id might be easiest to read as the names there include both the disk model number and serial number) rather than the /dev/sdX name, particularly in a boot script or configuration file referenced from a boot script such as hdparm.conf. (Any disk changes could cause those names to change, but the /dev/disk/by-* names will remain the same.)

In order to prevent the file systems from being mounted, add the noauto option to the relevant /etc/fstab entries. You will still be able to mount the file systems normally by manually running sudo mount /some/mount/point and not mounting the file systems unless/until they are needed will usually reduce the probability of unexpected disk activity (which would cause those noisy disks to spin up, then spin down again after reaching the spindown timeout).

a CVn

Posted 2013-08-23T19:55:47.483

Reputation: 26 553

Thanks for answer - but I'd prefer to prevent them spinning up instead of spinning them down on boot again. – drahnr – 2013-10-11T08:37:03.657

@drahnr Assuming your system supports disk power-up in standby, that indeed is a better match for what you are asking. This approach, however, is safe in the case when the system does not support that feature. – a CVn – 2013-10-11T08:59:01.993

I hope it does, I am already using a solution similar to yours for now, have yet to find out if my Mainboard does support it. – drahnr – 2013-10-11T09:39:41.430

0

I know the question is old, but I started searching info about not spinning a
disk at boot time years ago.
I think I have a solution:- do not spin up a disk at boot time using the PUIS feature.

Take a look at this question.

Veon

Posted 2013-08-23T19:55:47.483

Reputation: 31

Welcome to superuser: While this may or may not answer the question,(an answer has been accepted) it would be a better answer if you could provide some explanation why your solution works with detail and an easy to follow instructions. If you feel your answer is correct do these things and re-edit. Please take a couple of minutes and read:- http://superuser.com/help .Answering: http://superuser.com/help/how-to-answer, again welcome to superuser.Thankyou

– mic84 – 2017-05-22T14:43:23.610