Live data from Hacker News

Making a Linux home server sleep on idle and wake on demand – the simple way

dgross.ca

151–160 of 244 posts

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#151
post #18

I wonder how many sleep/wake cycles would it take a day to outweigh the TCO decrease of the power bill with the TCO increase of the increased stress/amortization of the hardware, especially HDDs.

Probably a lot. My anecdata: I have had four Seagate HDDs in my desktop PC since 2007 and despite a couple of remapped sectors, they're still working fine. I often power it on and off 1-2 times a day, and the drives are set to spin down when not in use. The SMART data for these drives shows approximately 37,000 power on hours and 17,000 start/stop cycles. That's about 4 years 3 months of actual power on time, and abo…

You probably meant 3 power cycles a day.

What is your spin-down time? I use the following on my server's fstab:

     UUID="abcd" /data btrfs defaults,noauto,compress=zstd,x-systemd.automount,x-systemd.mount-timeout=1min,x-systemd.idle-timeout=30min

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#152

This feels like the sort of functionality that ought to just work now. Its a clearly useful thing for PCs all over the planet and it would be nice if they just went to sleep almost completely when idle and woke up on network or USB/PS2 input. The power savings would be enormous. Yet today I still have issues with power saving features, performance is lowered by having power saving on instead of flat out and various t…

The main problem is defining what it means to be idle.

Suppose you have some browser tabs open, so there is some javascript running to switch out the ads on the page every few seconds. Is that "idle"? There's CPU and network activity. Suppose there is an open ssh connection to a server. It sends keepalives because the client is remote and behind a NAT, but there is no "real" activity. Should the server go to sleep?

It's entirely possible to be too aggressive. Samsung is proving this. They've disable "unused" apps by default. But "unused" just means you haven't opened it in a while, not that you e.g. don't have a reminder set in it to give you an alert for something which is happening in six months.

Conversely, I wish web browsers were more aggressive about denying background tabs any use of the CPU whatsoever by default, and then allowing the user to make exceptions in the rare case where that's needed.

But in general the way to do this on the hardware side is per-component, and that's largely already happening. Modern CPUs and other devices at idle shut down most of the silicon and use hardly any power. I've seen Core i7 desktops use 6 watts at idle. In that case you hardly even need suspend, what you really need is for the hardware makers to find what's using the last 6 watts and get it down below 1.

Conversely, I've seen server hardware that uses over 10 watts when it's "off".

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#153

> Enable wake-on-LAN with unicast packets (not just magic packets) I didn't know there was more than one type of WOL packet?

There's not really such a thing as a "WOL packet" exactly. Basically the network interface accepts any old packet, and then maybe wakes up depending on the content of the packet.

You can configure it to wake up if it sees any packet (what he did). The problem is networks are rarely completely silent and your machine will just wake up randomly.

Which is why they invented "MagicPacket(tm)" which is just any old packet that happens to contain a specific repeated byte pattern. The network card will wake up on any packet that happens to contain that pattern (which shouldn't happen randomly).

I don't know why he didn't use MagicPacket, even though he mentioned the problem it solves.

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#154
post #16

Diagrams are just visible enough that I can tell that they're present but I cannot otherwise see them. I suppose that's because I'm using a dark theme on Firefox. Not that it matters. There's enough text to figure out what's going on in the first place and it would not help me much in any case. I have a file server running of an ancient server motherboard from another age. (Supermicro X8SIL w/X3460 and 16GB ECC RAM)…

That sounds like a lot. I have a HP Z440 with a Xeon e5-2650v4 (24 cores) with 128GB RAM, 2x8TB spinning rust, 1x PCIe SSD, and another SATA SSD that’s idling at 70W. When it’s scrubbing the drives, it goes to around 100W. Running proxmox. The machine without most of the drives and 32GB RAM cost me about 250$ used.

It's his CPU (X3460). They are quite ancient and were known for being power hungry (Nehalem). Even a move up to a $15 Broadwell chip would improve energy efficiency dramatically. The motherboard probably doesn't even support sleep states like S2/S3.

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#155
post #99
post #54

Earlier quoted context omitted.

I’m behind CGNAT for the last 1.5 years without issue. What am I missing? I actually prefer my router not being bombarded by connection attempts all day.

Try connecting to an SSH server for more than a few hours without passing traffic and then have the server be the one to send a message. Oops! Your ISP tore down the NAT association and you have no idea the server isn't sending anything until you try to communicate with the server and get a timeout / RST. NAT breaks TCP, but at least with consumer NAT you're in control of the timeouts on your router. With CGNAT you'r…

I actually used to have that issue years ago at work. To work around that I just enabled a keepalive (ServerAliveInterval maybe?) setting in my ssh config. I don’t connect to any ssh servers outside my house for long periods of time, so I haven’t encountered that. Thanks for the heads up, good info!

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#156
post #33

This looks like one of those home server infrastructure setup rabbit holes I would've bailed out of within the first 10 minutes of Googling to research the problem. I commend the author for their perseverance and the writeup - rabbit hole writeups are their own form of entertainment. That alone was worth it. I could never run anything that looks like such a conceptual pain the butt. A pain to maintain and troubleshoo…

That's what I was thinking too. My home server consumes like 15 W and is silent (and saturates gigabit).

If you get a rack mounted server made for data centers and stick it in a closet so you can't hear it then yes, i guess this approach makes sense.

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#157
post #20

Earlier quoted context omitted.

I'm curious if you have measured power at the well (e.g. smart plug with energy metering or Kill-a-watt.) I just set up a test server with a J1900 (10W TDP.) With 8GB RAM and running from an SSD it uses 25W. Add 4 7200RPM HDDs and it's up to 65W idling. I have another test server based on a Raspberry Pi 4B. The Pi boots from SD card and uses about 5W. Add 2 drives in a USB drive bay and power for the setup is now up…

> I just set up a test server with a J1900 (10W TDP.) With 8GB RAM and running from an SSD it uses 25W. Did you use a regular desktop power supply? PC power supplies can consume 10-15W or more at idle. To build a low power system you need to find a good low power, high efficiency power supply.

Does anyone know a good supplier for such supplies?

For 10 years my home server used a Corsair VS350; it was fantastic, and very efficient at low power draw. Recently the fan failed. The PSU seems discontinued. The _fan_ seems discontinued. I'm going to try replacing the fan but I don't know much about electronics. As a temporary measure, I got a regular "gaming PC" PSU and it has 10% more power draw, it's not efficient at all.

I've been looking for a replacement PSU, and I can only really find very high power ones - minimum about 550W - for reasonable prices. While you can run a low wattage PC on such PSUs, none of them make very much in the way of efficiency promises; only the highest certification, 80 Plus Titanium, makes efficiency promises for 10% load, e.g. it'll be 90% efficient for a 55W load on a 550W supply. Lower certifications only promise to be e.g. 80% efficient for a 110W load on a 550W supply, and make no promises at all about a 55W or 30W load.

So, how does one buy a good low power, high efficiency PSU, without it costing a fortune?

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#158

Saying Windows has had it since Windows 98 and then, acknowledging that the issue is wake-on-demand is a bit confusing to say the least. Obviously Linux can sleep easily since decades ago. The issue is wake on demand (and I don't know if Windows has that even) Edit: I don't why everyone's having issues. I run Fedora on a cheap Gigabyte G5KD and never had any problems. Never did with either of my thinkpads or my Xiaom…

> Obviously Linux can sleep easily since decades ago.

Over the last 5 years, I had about 4 laptops that I ran Linux on. Not a single one was able to survive this:

- Do some work on it - Close the lid - Drive somewhere else - Resume work

At best, the laptop would freeze and require a hard reset (extra annoying on Dell XPS for some reason). At worst, it will be completely draining of power. All of my linux-loving colleges had the same issues. Windows worked just fine on those laptops, btw.

If you're curious, we've advanced beyond simple Suspend-to-RAM in 2012 when haswell was released. Out of the 3 major OS that used on desktop, only linux doesn't support those features: https://www.anandtech.com/show/6355/intels-haswell-architect...

I rarely have issues with S3 on my linux/windows desktop, though.

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#159

> Enable wake-on-LAN with unicast packets (not just magic packets) I didn't know there was more than one type of WOL packet?

There's not really such a thing as a "WOL packet" exactly. Basically the network interface accepts any old packet, and then maybe wakes up depending on the content of the packet. You can configure it to wake up if it sees any packet (what he did). The problem is networks are rarely completely silent and your machine will just wake up randomly. Which is why they invented "MagicPacket(tm)" which is just any old packet…

He explained why: he wanted the server to wake just when someone is tried to SSH to it.

Re: Making a Linux home server sleep on idle and wake on demand – the simple way

#160
post #55

Earlier quoted context omitted.

However that requires the disk used for backup storage to also be always on.

Disk have power modes and can be spun down to save energy. A Raspberry Pi can run the OS on an SD card and mount the disk for backup storage. Leaving it in low power for a long period of time.

I'm worried about the wear on my drives spinning up and down so much? Maybe it isn't such a big deal. It is the most stressful time for spinning drives, though.
Post reply on HN