# Power management on server?

## The_Great_Sephiroth

On shell-only servers doing tasks like a sane server, cups server, or Samba server, what packages should I use for power management? I already install acpid and set it to start on the default runlevel for events such as power button presses. I know I have cpupower and upower. Both normally get installed on workstations. Which (both?) should I install on a server?

----------

## eccerr0r

I'll be honest with you, I do care about power consumption but the thing I hate most about server power consumption is that they need to be "operationally ready on demand" and waiting it for booting (if it even boots properly) or spinning up disks gets really tiring fast.

Upower deals with suspend/hibernate, two features that I'd rarely if ever use on a true "server" as waiting for a server to serve my requests is a pain.  Technically hibernate is a very rare possibility - in case I need to temporarily and quickly shut down the machine in an emergency and don't want to go through a full shutdown sequence.

I also found that on a properly C1-C7 working Cstate (ACPI) machine, CPU frequency doesn't matter way too much as long as you're not overclocking and need to bump up voltage.  So let it run whatever default frequency you bought the machine to run at, unless you don't care about slow and just leave the CPU underclocked all of the time.

Up to you, what are your key objectives?  Does it need to be ready 24/7?  A lot of the time a workstation profile is sufficient but I don't want my machine to be asleep when I need to use it remotely and have to coax it to wake up...

----------

## The_Great_Sephiroth

I guess I only need CPUPower then. The server will NEVER hibernate or sleep. I wasn't sure what upower did, I only know I need it with KDE on my workstations. I will let cpupower set the governor to ondemand and let it be. It is an AD DC with DHCP, DNS, VPN, and file services.

----------

## depontius

I wish drive spin-down were more straightforward.  I keep my backup drives unmounted, except while I'm backing them up.  I'd really like to spin them down, too.  It's only once a day, so it's not that much wear and tear.  I looked into it once, but I could only get one of my drives to spin down on command.  (hdparm)

----------

## eccerr0r

They should spin down fine, I have machines that spin down...but yes having them mounted tends to hurt the chances of them stop spinning.

"mounted" also implies use of LVM and especially md.  Having these used also counts as being mounted even if the overlaid filesystem isn't being used.

Once again, at least for me, servers need operational readiness.  If the disks are spun down and unmounted, that means at least you have to manually log in and mount them before you can use NFS or SMB or whatever.

----------

## depontius

How do you spin them down?  I tried various USB options to no avail, but I'm willing to accept that I missed something.  I got one drive to spin down with hdparm, but not the others.  These are only backup drives that I'm wanting to spin down, so that would get taken care of by the cron job....  Spin up, back-up, spin down.

----------

## eccerr0r

USB there's no guarantee.  It depends on your USB chipset whether it will spin down or not and there are a lot of cheap ones that do not spin down.

Only reliable spin down are direct connect SATA/IDE.  I avoid USB like the plague, again for reliability.  USB isn't reliable imho.

----------

## depontius

But when it's a portable drive, meant to be swapped with the one in my office at work, USB is pretty darned convenient.

----------

## The_Great_Sephiroth

I leave my drives at the default settings. I'd prefer they never stop. Starts and stops shorten desktop/server drive lifespan more than staying live.

----------

## dmpogo

On a server (even home server) I never suspend/hybernate or spin down disks (spin up/down is what kills spindle disks in the long run, in constant on state they are happy for many years), so I don't need any user level power management.  Modern CPU's happily go into lower power state by themselves when the kernel is properly configured.

That leaves you with power used by disks - choose the ones that use less,   they usually use just 1-2 watts when spinning idly

----------

## musv

I'm using a small ARM based NAS server at home with a lot of installed services. 

The NAS contains 2 harddisks: 1 SSD (system) and 1 HDD (media + downloads) and runs 24/7. Via udev rule I put the HDD after 30 minutes inactivity into standby mode. For the rest of the system I've installed Powertop, which put's some devices  (e.g. USB) into a powersave mode.

----------

## eccerr0r

Yeah I don't usually let disks spin down, nor do they want to due to the random disk traffic.

My main server is a Core2 Quad that I leave up 24/7, it runs VMs and now has three 2TB disks running root on LVM over MD RAID5.  No chance getting these to spin down (plus, one of its VMs is a public facing webserver and never know who submits a HTTP request).  Due to RAID5, files are distributed across the disks and need to deal with parity as well.

I do have another machine I use as a disk backup and is loaded with random hard drives.  It readily can spin disks down when I leave the disks unmounted as I only need it for backing up the main server.  Oddly enough, I wish these SATA disks wouldn't all spin up at the same time on boot (does not appear to be an option for stagger start) as the original power supply had trouble spinning them all up simultaneously.  After the disks are spinning, the new beefier power supply is complete overkill.  Grr.

----------

## The_Great_Sephiroth

Doesn't the BIOS start the disks initially? Staggering may be a BIOS option. Some of my systems stagger them prior to POST, others do them all at once.

----------

## eccerr0r

BIOS can start disks, but if the disks come up on their own when power is applied, it's too late.

The feature that is desired is on the disk themselves - feature is usually called "delayed start" or "stagger start".  Old SCSI drives meant for arrays have a jumper to enable this, and I think some modern hard drives have a firmware hack to enable this as well.

Maybe someday there's an hdparm setting to do this as a standard...

--- 

Actually when one looks, you get an answer.

hdparm supports a -s option to enable stagger start.  However it's one of these "VERY DANGEROUS" options... and that it probably only works with WD disks...

----------

