Power saving by enabling hard disk AdvancedPM mode HOW TO
From openSUSE
Contents |
Introduction
Now how can hard disks be made more energy efficient? Quite simple, you let them go into energy saving mode. In order to do so, the disk needs to support it and be of the non solid-state type.
This guide is probably best used for PC's acting as a server of sorts as it's going to get rid of some packages that might come in handy on a desktop as well as slowing access to files.
Example of where it pays off
As an example to demonstrate a good use I'll describe my own situation. I got one PC in my house acting as a download server for bittorrent. This PC is turned on 24/7 and has 4 disks, 1 disk is used to store all current downloads while the 3 others are configured as a raid 5 array where all completed downloads are archived.
So in practice this means that I got one hard disk that's nearly always active, and three disks that only need to be active when someone accesses an archived file. So that makes those 3 disks excellent candidates to enable power saving on.
Checking whether you can even make use of this how-to
Before we can get to work we need find out a few things first.
- Where your disks can be found
- If they support power saving mode.
I'll try to keep this as much copy and paste as possible so that you can mostly copy and paste the blocks below. Start up a console and obtain root priveleges
su -
After you hit enter you're asked for your password, type it in and hit enter again.
Finding your disks
First things first.. finding the disks. In the shell window opened in the previous step issue the following command:
dir -l /dev/sd*
This returns a list with all the disks and partitions in your system. Something like the example below.
brw-rw---- 1 root disk 8, 0 2008-12-17 01:34 /dev/sda brw-rw---- 1 root disk 8, 1 2008-12-17 01:34 /dev/sda1 brw-rw---- 1 root disk 8, 2 2008-12-17 01:33 /dev/sda2 brw-rw---- 1 root disk 8, 3 2008-12-17 01:34 /dev/sda3 brw-rw---- 1 root disk 8, 16 2008-12-17 01:34 /dev/sdb brw-rw---- 1 root disk 8, 17 2008-12-17 01:34 /dev/sdb1 brw-rw---- 1 root disk 8, 32 2008-12-17 01:34 /dev/sdc brw-rw---- 1 root disk 8, 33 2008-12-17 01:34 /dev/sdc1 brw-rw---- 1 root disk 8, 48 2008-12-17 01:34 /dev/sdd brw-rw---- 1 root disk 8, 49 2008-12-17 01:34 /dev/sdd1
We're only interested in the results with an orange background. As you might have noticed, these are the results without a number behind them. The ones with a number at the end are partitions which are irrelevant to us.
Remember I told you I have 4 hard disks? sda is my download disk, sdb/sdc/sdd are my 'archive' hard disks. Write down the /dev/sdb/ etc of the disks you want to enable power saving on down somewhere.. you'll need it later.
Checking disk power saving support
The command which returns a list of features supported by your harddisk is hdparm -i /path/todisk so combine it with what you found in the previous step. For example:
hdparm -i /dev/sdb
Which in my case returned /dev/sdb:
Model=SAMSUNG HD103UJ , FwRev=1AA01113, SerialNo=S13PJ90Q906786
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4
BuffType=DualPortCache, BuffSize=32767kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-3,4,5,6,7
* signifies the current active mode
The interesting bit has an orange background-color again, AdvancedPM=yes means that this disk comes with Advanced Powermanagement. Repeat this command for all your disks you want to enable power saving on, and write down that answer with yes. If all your disks come up with AdvancedPM=no, I'm sorry but you can stop reading the guide.
Prevent unnecessary disk access
This is were we start killing off some things you might find useful on a regular desktop.. openSUSE by default installs some tools to help you find files faster. These programs might get your disk out of powersaving mode, and we don't want that happening so we'll get rid of them.
Strigi
| KDE 4 | GNOME |
|---|---|
|
Beagle
Hope you still got your shell window with root priveleges open.. use the command below.
zypper se beagle
then type in the command zypper rm and behind it everything you found with the previous command that has the letter I (installed) infront of it. For example:
zypper rm beagle beagle-index beagle-thunderbird kde4-bio-beagle kdebase3-beagle kio-beagle libbeagle1
Hit enter when you got your list ready and zypper will inform you about changes etc, hit the y key on your keyboard followed by an enter.
Finally.. enabling power saving
If you're using a RAID like me take a look at RAID Specific further down the page
Hope you got your list with disks that have AdvancedPm support at hand cause we'll put it to use right now. We'll be making use of the hdparam command again, but this time to set power saving instead of just checking if it's supported. As we'll be making use of the -B and -S parameters, here is the MAN page info on them.
-B Set Advanced Power Management feature, if the drive supports it. A low value means aggressive power management and a high value means better performance. Possible settings range from values 1 through 127 (which permit spin- down), and values 128 through 254 (which do not permit spin-down). The highest degree of power management is attained with a setting of 1, and the highest I/O performance with a setting of 254. A value of 255 tells hdparm to disable Advanced Power Management altogether on the drive (not all drives support disabling it, but most do).
In my case.. I really couldn't care less for performance as the files on the disk aren't accessed -that- often. So for me the '1' setting is perfect. The other parameter we'll be using (-S),is a rather odd way to set the time
-S Set the standby (spindown) timeout for the drive. This value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. 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.
Well I'm just guessing here.. I got some movies on the disk, accessible via a NFS share, I assume some buffering is done so mweh.. 2 minutes sounds good to me. 2 minutes = 120 seconds = 120 / 5 = 24 (or at least it is according to my head calculations, but I never was good at math..)
So the command below should set the disk to take a nap whenever it isn't accessed for 2 minutes: PLEASE PAY ATTENTION TO CaSe-SeNsItIvItY HERE, as using a small letter s can potentially mess up your system.
hdparm -B 1 -S 24 /dev/sdb
If the console responds with:
/dev/sdb: setting Advanced Power Management level to 0x01 (1) setting standby to 24 (2 minutes)
Everything went well, and yay for me.. my math was dead on.
Repeat the process for all your disks and hopefully next time the electricity bill needs to be paid it's lower than it was before.
RAID Specific
If you're using a RAID setup, it's important to know that all the disks wake up in sequence. So if your got 3 disks in RAID 5 and each disk takes 30 seconds to wake up, and you set the timer to 1 minute.. you got a problem. Disk 1 wakes up = 30 seconds + second disk = 60 seconds, so the first goes back to sleep.. while the last is just waking up.
Simply put, the more disks you have the bigger the timeout is you'll need to set. To be safe you might want to use the formula: Number of discs * 45 seconds.
Other
Tips
- Disable HDD temperature monitoring *. (every time it asks the temperature it wakes the disk up)
- Close all windows you might have opened when leaving the PC, GUI's that need to be updated will put your CPU to work.
- Turn your monitor OFF instead of in standby
* If you feel lucky you can try the command hdparm -H path/todisk. It's a way to get the temperature without waking the disk up, but supported by very few disks.
Lesswats
If you want to save some more electricity take a look at - Saving power on linux.
As the LessWatts site only seems to be mention Intel and not openSUSE's sponsor AMD I felt obligated to make the table below listing the AMD counterparts of the Intel energy saving functions.
| Intel | AMD |
|---|---|
| Intel SpeedStep® Technology (EIST) | Cool'n'Quiet |
| Speedstep | PowerNow!™ |
Hardware
If you truly want to save power, you should keep this in mind when purchasing your hardware! The number one way to save power is to use a quality power supply bearing the 80 Plus certified mark of quality. They cost a bit more than the average power supply but it's only matter of time before they pay themselves back. If you are trying to save power not just to lower the electricity bill but for the good of the environment you might find the Antec Earthwatts of particular interest.
Most 'homeservers' are ex-desktops, now this is a nice way to put your old hardware to use.. but it might be worth it to just sell your 'old' desktop when you upgrade to a new one and spend the money on energy efficient hardware. Intels atom processor is nice for a very low power consumption system, but it takes it's poll on performance.
If you need a step up in performance, AMD processors with "LE" in their name are cheap to purchase and consume less power then ones without "LE" in their name.


