Linux power off disk

Команда hdparm linux

Утилита hdparm позволяет устанавливать и просматривать различные параметры жестких дисков HDD в Linux. Она работает только в командной строке и предоставляет доступ к настройкам кэша диска, режима сна, энергопотребления, уровня его производительности, шума, а также DMA. Возможности этой утилиты используются в GParted.

Изменение стандартных значений для некоторых параметров может очень сильно увеличить производительность диска, однако на данный момент нет точного способа определить оптимальные значения. Это можно сделать только путём проб и ошибок. В этой небольшой статье мы разберемся как работает команда hdparm linux, а также что с помощью неё можно сделать.

Синтаксис команды hdparm

Синтаксис hdparm Linux очень похож на другие подобные команды:

$ hdparm опция значение /dev/имя_файла_диска

Если опцию передать без значения, то как правило, она просто выводит текущее значения параметра, если передать значение, то оно устанавливается вместо старого. Давайте сначала рассмотрим основные опции утилиты, которые мы будем сегодня использовать:

  • -a — позволяет включить режим read-ahead, когда чтение выполняется в первую очередь. Этот режим позволяет улучшить производительность чтения больших объемов данных;
  • -A — позволяет включить режим read-look-ahead, когда диск просматривается перед чтением. По умолчанию включена;
  • -b — остановить жесткий диск до следующего к нему обращения;
  • -B — настройка управления питанием Advanced Power Management (APM), чем ниже значение, тем лучше энергосбережение. Чтобы отключить режим полностью установите значение в 255.
  • -c — включает 32-битный режим передачи для IDE;
  • -C — позволяет посмотреть текущий режим питания IDE;
  • -d — включает режим DMA;
  • -D — включает обнаружение дефектных областей на диске;
  • -E — позволяет установить скорость для CD/DVD привода;
  • -f — позволяет записать кэш диска на носитель;
  • -i — выводит информацию о диске;
  • -I — тоже выводит информацию о диске, но в более подробной форме;
  • -m — позволяет указать количество секторов для многосекторного ввода/вывода. Чтобы отключить эту опцию установите её в 0;
  • -M — позволяет управлять уровнем шума диска с помощью Automatic Acoustic Management (AAM);
  • -n — позволяет включить флаг ignore write errors для игнорирования ошибок записи;
  • -r — включает флаг read only. После этого с устройства можно только читать данные, но не записывать;
  • -S — устанавливает время неактивности диска для перехода его в режим сна. Если установлено в 0, то диск сразу же отключается;
  • -T — выполняет тест скорости чтения из кэша;
  • -t — выполняет тест скорости чтения с диска без кэширования;
  • -v — выводит все настройки;
  • -w — выполняет сброс диска;
  • -W — включает или отключает кэш для записи данных на IDE;
  • -y — переводит IDE диск в режим низкого энергопотребления, замедляя скорость вращения диска;
  • -Y — переводит IDE диск в режим низкого энергопотребления останавливая его;
  • -z — просит ядро перечитать таблицу разделов для этого диска;
  • -Z — отключает режим энергосбережения диска.

Установка hdparm

Если утилита ещё не установлена в вашей операционной системе, то её можно установить из официальных репозиториев дистрибутива. Например, для установки hdparm Ubuntu / Debian / Linux Mint выполните:

sudo apt install hdparm

А для CentOS/Fedora/RedHat:

sudo dnf install hdparm

Примеры команды hdparm

И так программу установили, можно и к действиям переходить. Давайте сначала посмотрим информацию о диске с помощью опции -i:

sudo hdparm -i /dev/sda

Теперь смотрим более расширенную информацию опцией -I:

sudo hdparm -I /dev/sda

Чтобы посмотреть текущие настройки для различных флагов диска используйте опцию -v:

sudo hdparm -v /dev/sda

Для теста скорости работы диска с кэшем используйте опцию -T:

sudo hdparm -T /dev/sda

А для теста без кэша -t:

sudo hdparm -t /dev/sda

Чтобы остановить вращение мотора диска до следующего к нему обращения выполните:

sudo hdparm -S 1 /dev/sda

После включения этой опции диск перейдет в режим сна сразу же через пять секунд после завершения операций с ним. Если же вы хотите уменьшить энергопотребление вашего устройства предыдущая команда не совсем подходит. Для этого существует функция управления питанием:

sudo hdparm -B 120 /dev/sda

Замедляет обороты диска если к нему не обращались на протяжении определенного времени, доступны значения от нуля до 255, 120 примерно среднее значение.

Разберемся подробнее с опцией -S. Она позволяет останавливает двигатель диска после время бездействия:

sudo hdparm -S 240 /dev/sda

Можно также использовать числа в диапазоне от 1 до 255. Значения от единицы до 240 означают время в секундах умноженное на 5. Таким образом можно рассчитать время ожидания от 5 секунд до двадцати минут. Значения от 241 до 251 рассчитывается уже умножением на 30 минут, таким образом можно получить время от тридцати минут до пяти с половиной часов.

Чтобы уменьшить уровень шума от диска можно ещё воспользоваться опцией -M. Она принимает значения от 128 что означает более тихую работу и до 254, которое означает более высокую производительность. Попросим диск работать как можно тише:

sudo hdparm -M 128 /dev/sda

Выводы

В этой статье мы рассмотрели как пользоваться hdparm для настройки диска в Linux. Всё выглядит сложным, но зато вы можете немного повысить производительность своего диска, снизить его энергопотребление или шум.

Источник

hdparm

hdparm is a command line utility to set and view hardware parameters of hard disk drives. It can also be used as a simple benchmarking tool.

Contents

Installation

Install the hdparm package. For use with SCSI devices, install the sdparm package.

Usage

Disk info

To get information about hard disks, run the following:

Benchmarking

Power management configuration

Modern hard drives support numerous power management features, the most common ones are summarized in the following table. See hdparm(8) for the complete list.

Parameter Description
-B Set the Advanced Power Management feature. Possible values are between 1 and 255, low values mean more aggressive power management and higher values mean better performance. Values from 1 to 127 permit spin-down, whereas values from 128 to 254 do not. A value of 255 completely disables the feature.
-S Set the standby (spindown) timeout for the drive. The timeout specifies how long to wait in idle (with no disk activity) before turning off the motor to save power. The value of 0 disables spindown, the values from 1 to 240 specify multiples of 5 seconds and values from 241 to 251 specify multiples of 30 minutes.
-M Set the Automatic Acoustic Management feature. Most modern hard disk drives have the ability to speed down the head movements to reduce their noise output. The possible value depends on the disk, some disks may not support this feature.
Читайте также:  Windows device recovery tool получение информации

To query current value, pass the parameter without a value. For example:

To apply different value, for example set APM to 127:

Tips and tricks

Querying the status of the disk without waking it up

Invoking hdparm with the query option is known to wake-up some drives. In this case, consider smartctl provided by smartmontools to query the device which will not wake up a sleeping disk. For example:

Persistent configuration using udev rule

To make the setting persistent across reboot, one can use a udev rule:

Because a disk device can be assigned randomly to a changing /dev/sdX , the disk can also be identified by its serial as explained in Udev#Identifying a disk by its serial.

Systems with multiple hard drives can apply the rule in a flexible way according to some criteria. For example, to apply power-saving settings to all rotational drives (hard disk with rotational head, excluding in particular solid state drives), use the following rule:

Reapplying configuration after wakeup

If the configuration is lost after system suspension/hibernation, it can be reapplied using systemd-sleep.

Put a script into /usr/lib/systemd/system-sleep and make it executable:

Putting a drive to sleep directly after boot

A device which is rarely needed can be put to sleep directly at the end of the boot process. This does not work with the above udev rule because it happens too early. In order to issue the command when the boot is completed, just create a systemd service and enable it:

Working with unsupported hardware

Some drives do not support spin down via hdparm. A diagnostic error message similar to the following is a good indication this is the case:

For some other drives, the hdparm command is acknowledged but the drive do not respect the parameters (either APM or spin down timer). This was observed with a Toshiba P300 (model HDWD120) HDD.

Such drives can be spun down using hd-idle which ships with a systemd service. One need to edit /etc/conf.d/hd-idle and the HD_IDLE_OPTS value, then start and enable hd-idle.service .

Example using a 10 min idle time for /dev/sda and a 1 min idle time for /dev/disk/by-uuid/01CF0AC9AA5EAF70 :

the leading -i 0 parameter indicates that hd-idle is disabled on other drives.

Power management for Western Digital Green drives

Western Digital Green hard drives have a special idle3 timer which controls how long the drive waits before positioning its heads in their park position and entering a low power consumption state. The factory default is aggressively set to 8 seconds, which can result in thousands of head load/unload cycles in a short period of time and eventually premature failure, not to mention the performance impact of the drive often having to wake-up before doing routine I/O. Western Digital issued a statement, claiming that Linux is not optimized for low power storage devices and advising to reduce logging frequency. There are different ways to amend the idle3 state:

  1. Western Digital supplies a DOS utility wdidle3.exe for download for tweaking this setting. This utility is designed to upgrade only the firmware of the following hard drives: WD1000FYPS, WD7500AYPS, WD7501AYPS but is known to be able to change the idle3 timer of other Green models as well.
  2. hdparm features a reverse-engineered implementation behind the -J flag, which is not as complete as the original official program, even though it seems to work on at least a few drives. A setting of 30 seconds is recommended for Linux use. Specify a value of zero (0) to disable the WD idle3 timer completely (not recommended): See #Persistent configuration using udev rule to automatically use this parameter on supported hard drives.
  3. Another unofficial utility is provided by the idle3-tools package. A raw idle3 value is passed as a parameter of the idle3ctl command. The correspondence between this value and the timeout in seconds is provided in the bottom table within idle3ctl(8) . The following command sets the timer to 30 seconds: The following completely disables the timer (not recommended):

Troubleshooting

APM level reset after suspend

The APM level may get reset after a suspend requiring it to be re-executed after each resume. This can be automated with the following systemd unit (adapted from a forum thread):

Источник

Power management

Power management is a feature that turns off the power or switches system’s components to a low-power state when inactive.

In Arch Linux, power management consists of two main parts:

  1. Configuration of the Linux kernel, which interacts with the hardware.
    • Kernel parameters
    • Kernel modules
    • udev rules
  2. Configuration of userspace tools, which interact with the kernel and react to its events. Many userspace tools also allow to modify kernel configuration in a «user-friendly» way. See #Userspace tools for the options.

Contents

Userspace tools

Using these tools can replace setting a lot of settings by hand. Only run one of these tools to avoid possible conflicts as they all work more or less similarly. Have a look at the power management category to get an overview on what power management options exist in Arch Linux.

These are the more popular scripts and tools designed to help power saving:

Console

  • acpid — A daemon for delivering ACPI power management events with netlink support.

https://sourceforge.net/projects/acpid2/ || acpid

  • Laptop Mode Tools — Utility to configure laptop power saving settings, considered by many to be the de facto utility for power saving though may take a bit of configuration.

https://github.com/rickysarraf/laptop-mode-tools || laptop-mode-toolsAUR

  • libsmbios — Library and tools for interacting with Dell SMBIOS tables.

https://github.com/dell/libsmbios || libsmbios

  • powertop — A tool to diagnose issues with power consumption and power management to help set power saving settings.

https://01.org/powertop/ || powertop

  • systemd — A system and service manager.

https://freedesktop.org/wiki/Software/systemd/ || systemd

  • TLP — Advanced power management for Linux.

https://linrunner.de/tlp || tlp

Graphical

  • batterymon-clone — Simple battery monitor tray icon.

https://github.com/jareksed/batterymon-clone || batterymon-cloneAUR

  • batsignal — Lightweight battery monitor that uses libnotify to warn of low battery levels.

https://github.com/electrickite/batsignal || batsignalAUR

  • cbatticon — Lightweight and fast battery icon that sits in your system tray.

https://github.com/valr/cbatticon || cbatticon

  • GNOME Power Statistics — System power information and statistics for GNOME.

https://gitlab.gnome.org/GNOME/gnome-power-manager || gnome-power-manager

  • KDE Power Devil — Power management module for Plasma.

https://invent.kde.org/plasma/powerdevil || powerdevil

  • LXQt Power Management — Power management module for LXQt.

https://github.com/lxqt/lxqt-powermanagement || lxqt-powermanagement

  • MATE Power Management — Power management tool for MATE.

https://github.com/mate-desktop/mate-power-manager || mate-power-manager

  • MATE Power Statistics — System power information and statistics for MATE.

https://github.com/mate-desktop/mate-power-manager || mate-power-manager

  • powerkit — Desktop independent power manager.

https://github.com/rodlie/powerkit || powerkitAUR

  • Xfce Power Manager — Power manager for Xfce.

https://docs.xfce.org/xfce/xfce4-power-manager/start || xfce4-power-manager

  • vattery — Battery monitoring application written in Vala that will display the status of a laptop battery in a system tray.

https://www.jezra.net/projects/vattery.html || vatteryAUR

Power management with systemd

ACPI events

systemd handles some power-related ACPI events, whose actions can be configured in /etc/systemd/logind.conf or /etc/systemd/logind.conf.d/*.conf — see logind.conf(5) . On systems with no dedicated power manager, this may replace the acpid daemon which is usually used to react to these ACPI events.

The specified action for each event can be one of ignore , poweroff , reboot , halt , suspend , hibernate , hybrid-sleep , suspend-then-hibernate , lock or kexec . In case of hibernation and suspension, they must be properly set up. If an event is not configured, systemd will use a default action.

Event handler Description Default action
HandlePowerKey Triggered when the power key/button is pressed. poweroff
HandleSuspendKey Triggered when the suspend key/button is pressed. suspend
HandleHibernateKey Triggered when the hibernate key/button is pressed. hibernate
HandleLidSwitch Triggered when the lid is closed, except in the cases below. suspend
HandleLidSwitchDocked Triggered when the lid is closed if the system is inserted in a docking station, or more than one display is connected. ignore
HandleLidSwitchExternalPower Triggered when the lid is closed if the system is connected to external power. action set for HandleLidSwitch
Читайте также:  Чистильщик для линукс минт

To apply any changes, signal systemd-logind with HUP :

Power managers

Some desktop environments include power managers which inhibit (temporarily turn off) some or all of the systemd ACPI settings. If such a power manager is running, then the actions for ACPI events can be configured in the power manager alone. Changes to /etc/systemd/logind.conf or /etc/systemd/logind.conf.d/*.conf need be made only if you wish to configure behaviour for a particular event that is not inhibited by the power manager.

Note that if the power manager does not inhibit systemd for the appropriate events you can end up with a situation where systemd suspends your system and then when the system is woken up the other power manager suspends it again. As of December 2016, the power managers of KDE, GNOME, Xfce and MATE issue the necessary inhibited commands. If the inhibited commands are not being issued, such as when using acpid or others to handle ACPI events, set the Handle options to ignore . See also systemd-inhibit(1) .

xss-lock

xss-lock subscribes to the systemd-events suspend , hibernate , lock-session , and unlock-session with appropriate actions (run locker and wait for user to unlock or kill locker). xss-lock also reacts to DPMS events and runs or kills the locker in response.

Start xss-lock in your autostart, for example

Suspend and hibernate

systemd provides commands to suspend to RAM or hibernate using the kernel’s native suspend/resume functionality. There are also mechanisms to add hooks to customize pre- and post-suspend actions.

systemctl suspend should work out of the box, for systemctl hibernate to work on your system you need to follow the instructions at Suspend and hibernate#Hibernation.

There are also two modes combining suspend and hibernate:

  • systemctl hybrid-sleep suspends the system both to RAM and disk, so a complete power loss does not result in lost data. This mode is also called suspend to both.
  • systemctl suspend-then-hibernate initially suspends the system to RAM and if it is not interrupted within the delay specified by HibernateDelaySec in systemd-sleep.conf(5) , then the system will be woken using an RTC alarm and hibernated.

Hybrid-sleep on suspend or hibernation request

It is possible to configure systemd to always do a hybrid-sleep even on a suspend or hibernation request.

The default suspend and hibernation action can be configured in the /etc/systemd/sleep.conf file. To set both actions to hybrid-sleep:

Sleep hooks

Suspend/resume service files

Service files can be hooked into suspend.target, hibernate.target, sleep.target, hybrid-sleep.target and suspend-then-hibernate.target to execute actions before or after suspend/hibernate. Separate files should be created for user actions and root/system actions. Enable the suspend@user and resume@user services to have them started at boot. Examples:

For root/system actions (enable the root-resume and root-suspend services to have them started at boot):

Combined Suspend/resume service file

With the combined suspend/resume service file, a single hook does all the work for different phases (sleep/resume) and for different targets (suspend/hibernate/hybrid-sleep).

Example and explanation:

  • RemainAfterExit=yes : After started, the service is considered active until it is explicitly stopped.
  • StopWhenUnneeded=yes : When active, the service will be stopped if no other active service requires it. In this specific example, it will be stopped after sleep.target is stopped.
  • Because sleep.target is pulled in by suspend.target, hibernate.target and hybrid-sleep.target and because sleep.target itself is a StopWhenUnneeded service, the hook is guaranteed to start/stop properly for different tasks.
Generic service template

In this example, we create a template service which we can then use to hook any existing systemd service to power events:[1]

Then enable an instance of this template by specifying the basename of an existing systemd service after the @ , i.e., sleep@service-file-basename.service . See systemd.unit(5) § DESCRIPTION for more details on templates.

Hooks in /usr/lib/systemd/system-sleep

systemd runs all executables in /usr/lib/systemd/system-sleep/ , passing two arguments to each of them:

  • Argument 1: either pre or post , depending on whether the machine is going to sleep or waking up
  • Argument 2: suspend , hibernate or hybrid-sleep , depending on which is being invoked

systemd will run these scripts concurrently and not one after another.

The output of any custom script will be logged by systemd-suspend.service, systemd-hibernate.service or systemd-hybrid-sleep.service. You can see its output in systemd‘s journalctl:

An example of a custom sleep script:

Do not forget to make your script executable:

Troubleshooting

Delayed lid switch action

When performing lid switches in short succession, logind will delay the suspend action for up to 90s to detect possible docks. [3] This delay was made configurable with systemd v220:[4]

Suspend from corresponding laptop Fn key not working

If, regardless of the setting in logind.conf, the sleep button does not work (pressing it does not even produce a message in syslog), then logind is probably not watching the keyboard device. [5] Do:

You might see something like this:

Notice no keyboard device. Now obtain ATTRS for the parent keyboard device [6] :

Now write a custom udev rule to add the «power-switch» tag:

Restart systemd-udevd.service , reload rules by running udevadm trigger as root, and restart systemd-logind.service .

Now you should see Watching system buttons on /dev/input/event0 in syslog.

Power saving

This section is a reference for creating custom scripts and power saving settings such as by udev rules. Make sure that the settings are not managed by some other utility to avoid conflicts.

Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to dynamic overclocking.

Processors with Intel HWP (Intel Hardware P-state) support

This article or section is a candidate for merging with CPU frequency scaling.

The available energy preferences of a HWP supported processor are default performance balance_performance balance_power power .

This can be validated by running

To conserve more energy, you can configuration by creating the following file:

See the systemd-tmpfiles(8) and tmpfiles.d(5) man pages for details.

Audio

Kernel

By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create the following file for Intel soundcards.

Alternatively, use the following for ac97:

It is also possible to further reduce the audio power requirements by disabling the HDMI audio output, which can done by blacklisting the appropriate kernel modules (e.g. snd_hda_codec_hdmi in case of Intel hardware).

PulseAudio

By default, PulseAudio suspends any audio sources that have become idle for too long. When using an external USB microphone, recordings may start with a pop sound. As a workaround, comment out the following line in /etc/pulse/default.pa :

Читайте также:  Синий экран memory management windows 10 при запуске

Afterwards, restart PulseAudio with systemctl restart —user pulseaudio .

Backlight

Bluetooth

This article or section needs expansion.

To disable bluetooth completely, blacklist the btusb and bluetooth modules.

To turn off bluetooth only temporarily, use rfkill:

Or with udev rule:

Web camera

If you will not use integrated web camera then blacklist the uvcvideo module.

Kernel parameters

This section uses configurations in /etc/sysctl.d/ , which is «a drop-in directory for kernel sysctl parameters.» See The New Configuration Files and more specifically sysctl.d(5) for more information.

Disabling NMI watchdog

This article or section needs expansion.

The NMI watchdog is a debugging feature to catch hardware hangs that cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage:

or add nmi_watchdog=0 to the kernel line to disable it completely from early boot.

Writeback Time

Increasing the virtual memory dirty writeback time helps to aggregate disk I/O together, thus reducing spanned disk writes, and increasing power saving. To set the value to 60 seconds (default is 5 seconds):

To do the same for journal commits on supported filesystems (e.g. ext4, btrfs. ), use commit=60 as a option in fstab.

Note that this value is modified as a side effect of the Laptop Mode setting below. See also sysctl#Virtual memory for other parameters affecting I/O performance and power saving.

Laptop Mode

See the kernel documentation on the laptop mode «knob». «A sensible value for the knob is 5 seconds.»

Network interfaces

Wake-on-LAN can be a useful feature, but if you are not making use of it then it is simply draining extra power waiting for a magic packet while in suspend. You can adapt the Wake-on-LAN#udev rule to disable the feature for all ethernet interfaces. To enable powersaving with iw on all wireless interfaces:

The name of the configuration file is important. With the use of persistent device names in systemd, the above network rule, named lexicographically after 80-net-setup-link.rules , is applied after the device is renamed with a persistent name e.g. wlan0 renamed wlp3s0 . Be aware that the RUN command is executed after all rules have been processed and must anyway use the persistent name, available in $name for the matched device.

Intel wireless cards (iwlwifi)

Additional power saving functions of Intel wireless cards with iwlwifi driver can be enabled by passing the correct parameters to the kernel module. Making them persistent can be achieved by adding the lines below to the /etc/modprobe.d/iwlwifi.conf file:

This option will probably increase your median latency:

On kernels Bus power management

Active State Power Management

If the computer is believed not to support ASPM it will be disabled on boot:

ASPM is handled by the BIOS, if ASPM is disabled it will be because [7]:

  1. The BIOS disabled it for some reason (for conflicts?).
  2. PCIE requires ASPM but L0s are optional (so L0s might be disabled and only L1 enabled).
  3. The BIOS might not have been programmed for it.
  4. The BIOS is buggy.

If believing the computer has support for ASPM it can be forced on for the kernel to handle with the pcie_aspm=force kernel parameter.

To adjust to powersave do (the following command will not work unless enabled):

By default it looks like this:

PCI Runtime Power Management

The rule above powers all unused devices down, but some devices will not wake up again. To allow runtime power management only for devices that are known to work, use simple matching against vendor and device IDs (use lspci -nn to get these values):

Alternatively, to blacklist devices that are not working with PCI runtime power management and enable it for all other devices:

USB autosuspend

The Linux kernel can automatically suspend USB devices when they are not in use. This can sometimes save quite a bit of power, however some USB devices are not compatible with USB power saving and start to misbehave (common for USB mice/keyboards). udev rules based on whitelist or blacklist filtering can help to mitigate the problem.

The most simple and likely useless example is enabling autosuspend for all USB devices:

To allow autosuspend only for devices that are known to work, use simple matching against vendor and product IDs (use lsusb to get these values):

Alternatively, to blacklist devices that are not working with USB autosuspend and enable it for all other devices:

The default autosuspend idle delay time is controlled by the autosuspend parameter of the usbcore built-in kernel module. To set the delay to 5 seconds instead of the default 2 seconds, add the following kernel parameter for your bootloader.

Similarly to power/control , the delay time can be fine-tuned per device by setting the power/autosuspend attribute. This means, alternatively, autosuspend can be disabled by setting power/autosuspend to -1 (i.e., never autosuspend):

See the Linux kernel documentation for more information on USB power management.

This article or section is out of date.

Since Linux 4.15 there is a new setting called med_power_with_dipm that matches the behaviour of Windows IRST driver settings and should not cause data loss with recent SSD/HDD drives. The power saving can be significant, ranging from 1.0 to 1.5 Watts (when idle). It will become a default setting for Intel based laptops in Linux 4.16 [8].

The current setting can be read from /sys/class/scsi_host/host*/link_power_management_policy as follows:

Available ALPM settings

1.0 Watts

1.5 Watts

1.5 Watts

Setting Description Power saving
max_performance current default None
medium_power
med_power_with_dipm recommended setting
min_power WARNING: possible data loss

Hard disk drive

See hdparm#Power management configuration for drive parameters that can be set.

Power saving is not effective when too many programs are frequently writing to the disk. Tracking all programs, and how and when they write to disk is the way to limit disk usage. Use iotop to see which programs use the disk frequently. See Improving performance#Storage devices for other tips.

Also little things like setting the noatime option can help. If enough RAM is available, consider disabling or limiting swappiness as it has the possibility to limit a good number of disk writes.

CD-ROM or DVD drive

Tools and scripts

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Using a script and an udev rule

Since systemd users can suspend and hibernate through systemctl suspend or systemctl hibernate and handle acpi events with /etc/systemd/logind.conf , it might be interesting to remove pm-utils and acpid. There is just one thing systemd cannot do (as of systemd-204): power management depending on whether the system is running on AC or battery. To fill this gap, you can create a single udev rule that runs a script when the AC adapter is plugged and unplugged:

Examples of powersave scripts:

The above udev rule should work as expected, but if your power settings are not updated after a suspend or hibernate cycle, you should add a script in /usr/lib/systemd/system-sleep/ with the following contents:

Do not forget to make it executable!

This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.

Источник

Оцените статью