Linux - предотвращение раскручивания дисков

3793
drahnr

При загрузке все диски раскручиваются, но 4 просто резервные (и тоже довольно шумные). Так что я бы предпочел никогда не раскручивать их вообще при загрузке.

Есть ли опция ядра, которая сообщает ядру, к какому порту SATA подключен диск и который содержит rootfs?

Как сделать так, чтобы диски не вращались при загрузке?

3
Вы выяснили, как провести неразрушающий контроль, если жесткий диск и материнская плата поддерживают команду `hddparm -s`? Adam Ryczkowski 10 лет назад 0
У меня еще не было много времени и свободного места на диске, чтобы все сделать правильно. Так что это отложено на ранний марш. А пока я установил время вращения диска примерно на 1 минуту - но это только временное исправление. drahnr 10 лет назад 0

3 ответа на вопрос

4
Alain

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.

Что касается последней части, этого должно быть достаточно, чтобы просто отметить запись `noauto`. a CVn 10 лет назад 1
Моя материнская плата ASUS Z87-PLUS (как узнать? EFI действительно лонжероны, а сайт от ASUS бесполезен http://www.asus.com/Motherboards/Z87PLUS/), ядро ​​Linux должно поддерживать его правильно (до тех пор, пока мой корень живет на другом жестком диске), жесткие диски (WD20EARX-00PASB0, SAMSUNG HD103SJ) по крайней мере первый должен его поддерживать (согласно `hdparm -l / dev / sdf`). Вы уверены, что EFI должен это поддержать? drahnr 10 лет назад 0
3
a CVn

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).

Спасибо за ответ, но я бы предпочел, чтобы они не раскручивались, а не снова загружались при загрузке. drahnr 10 лет назад 0
@drahnr Предполагая, что ваша система поддерживает включение питания диска в режиме ожидания, это действительно лучше, чем вы просите. Этот подход, однако, является «безопасным» в том случае, если система не поддерживает эту функцию. a CVn 10 лет назад 0
Я надеюсь, что так и есть, я уже использую решение, подобное вашему, на данный момент, еще предстоит выяснить, поддерживает ли это моя материнская плата. drahnr 10 лет назад 0
0
Veon

Я знаю, что вопрос старый, но я начал искать информацию о том, как не крутить
диск во время загрузки несколько лет назад.
Я думаю, что у меня есть решение: - не раскручивайте диск во время загрузки с помощью функции PUIS.

Посмотрите на этот вопрос.

Добро пожаловать в суперпользователя: хотя это может или не может ответить на вопрос (ответ принят), было бы лучше ответить, если бы вы могли дать какое-то объяснение, почему ваше решение работает с подробностями и простыми инструкциями. Если вы чувствуете, что ваш ответ правильный, сделайте это и отредактируйте. Пожалуйста, уделите пару минут и прочитайте: - http://superuser.com/help. Ответ: http://superuser.com/help/how-to-answer, еще раз добро пожаловать в superuser.Thankyou mic84 6 лет назад 0

Похожие вопросы