DB-유

Synology Wake-on-LAN and Power Schedules

· synology, power, wol

Nobody in my house uses the NAS at three in the morning, so I stopped letting it run then. A desktop plus model draws 30 to 50 watts idle with drives spinning, and shutting it down for eight hours a night shows up on the power bill. When someone does need it outside the schedule, Wake-on-LAN brings it back in under two minutes.

Here's the DSM 6.2 setup: a power schedule, WOL, waking from Linux, Windows and the Synology apps, and HDD hibernation as the softer option. First check your model's spec sheet for "Wake on LAN/WAN" (all current desktop and rack models have it), use a wired connection because WOL doesn't work over Wi-Fi, and note the MAC of LAN 1 under Control Panel → Info Center → Network.

Turn on Wake-on-LAN

Control Panel → Hardware & Power → General → Power Recovery section: tick "Enable WOL on LAN 1" (and LAN 2 if it is in use). Also in this section:

Restart automatically after a power failure:  on
Enable WOL on LAN 1:                          on
Enable WOL on LAN 2:                          off

Power recovery matters because a NAS that was shut down by schedule and then loses mains power would otherwise not come back at all, since the WOL circuitry needs standby power to be present when the packet arrives.

Save, then shut the NAS down once from the DSM menu. WOL is only armed after a clean shutdown by DSM; a hard power cut does not arm it.

The power schedule

Control Panel → Hardware & Power → Power Schedule → Create:

Shutdown:  Mon–Fri 23:30, Sat–Sun 01:00
Startup:   Mon–Fri 06:30, Sat–Sun 08:00

Each line is a separate schedule entry with a day pattern and a time. The shutdown is a clean one, so open SMB sessions are closed and Btrfs flushes properly. Hyper Backup and other scheduled tasks must fit inside the running hours; a backup scheduled for 02:00 will never run. I found that out when a backup log stayed empty for a week. Move those tasks earlier or pick a later shutdown.

Waking it from Linux

On CentOS 7 or Ubuntu the tool is wakeonlan (Perl) or etherwake:

# Ubuntu
sudo apt install -y wakeonlan
wakeonlan 00:11:32:AB:CD:EF

# CentOS 7 (from EPEL)
sudo yum install -y epel-release
sudo yum install -y wol
wol 00:11:32:AB:CD:EF

The magic packet is a broadcast on the local subnet, so the sender must be on the same VLAN or the router must be configured to relay it. wakeonlan -i 10.20.30.255 00:11:32:AB:CD:EF targets the broadcast address explicitly, which helps on hosts with several interfaces.

A cron entry on an always-on Linux box that wakes the NAS at 06:20 on the days the schedule has it off is a good belt-and-braces measure, in case the internal clock drifts.

Windows and phones

On Windows there is no built-in tool, but PowerShell can send the packet:

$mac = "00-11-32-AB-CD-EF".Split('-') | ForEach-Object { [byte]('0x' + $_) }
$packet = [byte[]](,0xFF * 6) + ($mac * 16)
$udp = New-Object System.Net.Sockets.UdpClient
$udp.Connect(([System.Net.IPAddress]::Broadcast), 9)
$udp.Send($packet, $packet.Length) | Out-Null
$udp.Close()

Synology Assistant on Windows and Mac lists the NAS and offers Wake Up from the right-click menu when it is off. On a phone, DS finder shows the same unit greyed out with a Wake Up button; this works over the LAN or over Wi-Fi at home, and via QuickConnect only if another Synology device on the same network relays it.

Or use HDD hibernation instead

If users need the NAS reachable around the clock but it is idle most of the night, HDD hibernation is the alternative: Control Panel → Hardware & Power → HDD Hibernation:

Internal HDD hibernation:  after 20 minutes
External HDD hibernation:  after 10 minutes
Enable auto power off:     off

Drives spin down and the unit drops to 10 to 15 watts; the first access wakes them in a few seconds. In practice I find hibernation fragile, because any process that touches the disks keeps them awake: Docker containers with health checks, the indexing service, Surveillance Station, a phone with the Photos app. Enable the hibernation log under Support Center → Support Services → Log Generation to find out what is keeping them up.

Did it work?

  • After the scheduled shutdown, the unit is off and the LAN LED on the NIC still blinks slowly; that is standby power with WOL armed. If the NIC LED is dark, WOL is not armed.
  • Send a magic packet from the Linux host. The power LED should light within a second and DSM is reachable about 90 seconds later.
  • Check the log: Log Center → Log Search filter for "System" shows "System successfully shut down by power schedule" and "System started up" entries with the expected times.
  • sudo cat /var/log/messages | grep -i schedule on the NAS shows the scheduler firing.

Gotchas

  • WOL works from the LAN but not from a VPN or another subnet. Broadcast packets do not cross routers. Either run the wake command on a host inside the NAS's subnet over SSH, or configure the router for directed broadcast to the NAS subnet.
  • The NAS does not wake after a power cut. Standby power was lost and WOL disarmed. "Restart automatically after a power failure" only applies if the unit was running when the power went; a unit that was scheduled off stays off until the next scheduled startup. This is the scenario the cron-based wake covers.
  • The unit shuts down on schedule but does not start up again on schedule. The schedule's startup uses the RTC alarm, which is disabled on some models when the unit is on a UPS that reports "on battery". Check Control Panel → Hardware & Power → UPS.
  • Drives never hibernate. Check the hibernation debug log for the process name; the usual culprits on my units are synoindexd, docker, and dhcp-client writing lease files. Move Docker data off the main volume or exclude the folder from indexing.

Not glamorous, but it works. Just keep something always-on, or a phone, able to send the wake-up packet for the odd late night.