Tweak power consumption of NAS system

Hi all,

I've just finished building a new NAS which runs FreeBSD 12. The hardware is a i5-9400T (35W TDP) with 16GB of RAM, one M.2 SSD for the system and one SSD for the storage. In addition it powers one single fan (CPU).

Apart from enabling powerd(8), I haven't done anything regarding power consumption. Currently, when idle, the system is at about 15-17W. When under load, this goes up to ~20-27W.

Now since I am considering whether or not to run this 24/7, I would like to ask if there is any more potential of saving power, since the box will most likely be idle most of the day (and probably the whole night), or if I should just power it on upon demand (I have done the latter over the last 8 years with the previous NAS).
I am doing time machine backups on this NAS, so having it on 24/7 would be very convenient, time machine does incremental backups every couple of hours or so. Turning the box on on demand only would mean missing out on a lot of auto-backups from the laptop.

Anyway, this is what sysctl shows me:

Code:
dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.3.cx_usage_counters: 30041 0
dev.cpu.3.cx_usage: 100.00% 0.00% last 1233us
dev.cpu.3.cx_lowest: C1
dev.cpu.3.cx_supported: C1/1/1 C2/2/79
dev.cpu.3.%parent: acpi0
dev.cpu.3.%pnpinfo: _HID=none _UID=0
dev.cpu.3.%location: handle=\_PR_.PR03
dev.cpu.3.%driver: cpu
dev.cpu.3.%desc: ACPI CPU
dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.2.cx_usage_counters: 24578 0
dev.cpu.2.cx_usage: 100.00% 0.00% last 3425us
dev.cpu.2.cx_lowest: C1
dev.cpu.2.cx_supported: C1/1/1 C2/2/79
dev.cpu.2.%parent: acpi0
dev.cpu.2.%pnpinfo: _HID=none _UID=0
dev.cpu.2.%location: handle=\_PR_.PR02
dev.cpu.2.%driver: cpu
dev.cpu.2.%desc: ACPI CPU
dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.1.cx_usage_counters: 25391 0
dev.cpu.1.cx_usage: 100.00% 0.00% last 8199us
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_supported: C1/1/1 C2/2/79
dev.cpu.1.%parent: acpi0
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%location: handle=\_PR_.PR01
dev.cpu.1.%driver: cpu
dev.cpu.1.%desc: ACPI CPU
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.0.cx_usage_counters: 31681 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 12581us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/79
dev.cpu.0.freq_levels: 1801/35000 1800/35000 1700/32526 1600/30101 1500/28064 1400/25735 1300/23784 1200/21551 1100/19684 1000/17538 900/15753 800/13697
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.PR00
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

While being far from an expert here, it seems to me that thanks to powerd(8) the CPU is already throttled to 800MHz, which is great.

I have also read this: https://wiki.freebsd.org/SuspendResume
And my box is capable to suspending to RAM without issues and coming back up by pressing the power button. However, it seems like it cannot be brought back online by network access, so does not seem viable.

Is there anything else I could consider in terms of power saving? And advice/opinions? Or is this already the best I can get?

Thanks in advance for your help.
 
Turning the box on on demand only would mean missing out on a lot of auto-backups from the laptop.
You may want to have a look at Wake-on-LAN. The hardware must support this though. With WOL you can send a special "magic" packet over the network to remotely power it up.
 
You may want to have a look at Wake-on-LAN. The hardware must support this though. With WOL you can send a special "magic" packet over the network to remotely power it up.

Yes WOL is working, I turn the box on with that regularly, and did so with the previous box. However, network access (finder shares, time machines) don't send the WoL packet (as far as I am aware), so that would equal manually turning the box on/off.
 
However, network access (finder shares, time machines) don't send the WoL packet (as far as I am aware), so that would equal manually turning the box on/off.
No, but your backup software can usually be configured to execute a script before starting the backup cycle. You can use that script to send the WOL packet.
 
I am not aware of such functionality in Apple's time machine, and neither in the finder (navigating the NAS folders).

[edit] Maybe I should have mentioned that the NAS is used ~ 99% from a Apple MacBook, using either file sharing or time machine backups :) Rest would be git repositories, development servers and stuff.
 
I am not aware of such functionality in Apple's time machine, and neither in the finder (navigating the NAS folders).

[edit] Maybe I should have mentioned that the NAS is used ~ 99% from a Apple MacBook, using either file sharing or time machine backups
I have very little experience with MacOS, so I can't give you any pointers. But I'm sure some of our forum users may have some ideas, there's quite a big MacOS crowd here.
 
I am running FreeBSD 12.1 on a home server for file sharing or time machine backups as well. A few years ago, I moved all mail and web services to my home server, and now this requires 24/7 operation. Before, I simply turned it off over night and back on when I started my Mac in the morning using WoL. IMHO, anything else is not worth the hassle.

This is a quite old low end Atom system, and I calculate with apprx. 15 W as well. 8 hrs off-time would account for 15·8·365.25/1000 = 44 kWh per year, while the total electrical power consumption of my family accounts for ca. 3600 kWh per year. Now serving everything from my home server has an energy impact of 1.2 %, and generates extra costs of apprx. 14 € per year. At the same time I saved at least 200 € per year which would cost an EC2-AWS instance for running my mail and web services.
 
MacOS TimeMachine backs up hourly if I am not mistaken. No point in doing backups if you are asleep so the last backup taken before the MacBook was powered down or put to sleep should suffice. Personally I think hourly is too frequent but I don't change much on my MacBook - 99% of my Mac generated data is in iCloud.

Not sure TimeMachine does WoL I just checked my TimeMachine backups and they only occur when my macBook is in use (0700 to 1600 hrs daily).
 
There are a few things to fiddle with in the sysctl:

https://www.freebsd.org/cgi/man.cgi?acpi(4)

systemctl dev.cpu.0.cx_lowest=C5

Do this for each of your processors.
hw.acpi.cpu.cx_supported sysctl can tell you the lowest you can go.

Note: I tend to have too keep one of my CPUs at at least C3 or I run into issues.

There is also kern.hz (reduce to 100). I believe(?) this helps.

There is also one to disable all USB power but I can never find it ;).

If you want low power and this is for personal server rather than production, an older Raspberry Pi (running FreeBSD of course) is generally going to yield best results. x86 chips these days are monsters and can only scale back so far. It is like taking half the wheels off an 18 tonne truck, still won't be as fuel efficient as a car.
 
I am not aware of such functionality in Apple's time machine, and neither in the finder (navigating the NAS folders).
There isn't.

You could try the wakeonlan perl script. Perl5 is found by default on macOS ( I’m on High Sierra. [EDIT: Beginning with 10.15 Catalina it needs to be installed] ). Download as zip file, unpack, cd into directory, execute ./wakeonlan server-mac-address. If the script is of use you can create a executable in Automator -> Application -> Run Shell Script. [EDIT: You can set the executable to the login items of the user in System Preferences -> User & Groups . When you power up and log in your MacBook, the NAS gets an WOL automatically. ]

Also check the BIOS/UEFI ’s Power Management Setup if there are useful settings to your situation. On my system I can set an alarm to wake the computer on a specific date (“Everyday”) and time.
 
Last edited:
Yes WOL is working, I turn the box on with that regularly, and did so with the previous box. However, network access (finder shares, time machines) don't send the WoL packet (as far as I am aware), so that would equal manually turning the box on/off.
If WOL is working, try for the ON part
You could try the wakeonlan perl script.
and for the OFF part create a ssh-to-NAS.terminal executable to shutdown the FreeBSD NAS remotely, no need to go for a walk to push buttons.

On the FreeBSD NAS, activate sshd(8) in /etc/rc.conf, give a user /sbin/shutdown, or /sbin/poweroff privileges by sudo ( in /usr/local/etc/sudoers ) ( instead of security/sudo you can also use security/doas or security/super ).


On macOS open Terminal -> Preferences -> Profile ,
choose a profile or create a custom profile, e.g.: NAS-Poweroff ,
apply settings as viewed in in the image:

NAS-Poweroff.jpeg


in Run command: replace <user>@server-ip with actual values, close Preferences.

Open from the Terminal menu: Shell -> New Window -> NAS-Poweroff from the list
( a Terminal window opens, a ssh connection to the NAS is established ),
open Terminal menu: Shell -> Export Settings -> Save As: NAS-Poweroff.terminal

To power down the FreeBSD NAS, double click on the NAS-Poweroff.terminal executable, enter password. You can also create a shortcut on the Dock.

Note on ssh(1): When in ssh command is specified, it is executed on the remote host/server instead of a login shell.
 
Last edited:
Back
Top