Having a server at home is a great luxury, but having a computer running 24×7 is an extreme waste of energy. Turning it on and off manually is not very appealing, either. Luckily we have to do neither. Windows can easily be configured to put the computer into sleep mode (where modern PCs consume approx. 1 Watt) and have it wake up upon access.
Going to Sleep
This is the easy part. We do not have to do anything; the default power plan instructs Windows to go to sleep after 20 minutes of inactivity.
Getting Windows to wake up on demand sounds like a difficult thing. Those of you that know Wake-on-LAN may think of magic packets and networking tools. Those are certainly necessary in enterprise environments, but in the typical home network the situation is much simpler. Since there are only a handful of devices on the network and those do not talk to the server constantly we can simple instruct the server to wake up whenever anyone talks to it.
This is what the entire configuration looks like:
This works on Windows 7. Windows 8 is a bit special: Wake-On-LAN is only supported from sleep or hibernate, not from hybrid or classic shutdown. This is because, as KB2776718 states, “users expect zero power consumption and battery drain in the shutdown state”.
With your home server in sleep mode most of the time you might wonder how long it takes for the machine to wake up. From personal experience I can tell you that wakeup is extremely fast. If that does not convince you, the following test made against my home file server might:
C:\>ping hkserver Pinging hkserver.fritz.box [192.168.0.35] with 32 bytes of data: Reply from 192.168.0.24: Destination host unreachable. Request timed out. Reply from 192.168.0.35: bytes=32 time=3ms TTL=128 Reply from 192.168.0.35: bytes=32 time=8ms TTL=128 Ping statistics for 192.168.0.35: Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds: Minimum = 3ms, Maximum = 8ms, Average = 5ms
As you can see, only two pings are lost!
But wait, you may say, if my home server sleeps most of the time, with its RAM buffered by electrical power, what happens during a power outage? The machine would be reset brutally. That would be true if Windows did not use “Hybrid Sleep” by default, which is a combination of Sleep and Hibernate. The current state is buffered in RAM, but it is also written to disk. After a power outage, the system’s state is simply read from disk instead of RAM.