Note to future me: The reason the new server HDD would not sleep is because ext4lazyinit writes inodes slowly on new disks in the background, so the disks were immediately woken even if forced to sleep.
Build a low power server…
It will be easy, says me…
Replace our 10 year old Atom C2750 running FreeNAS/TrueNAS with a 6 disk raid, that uses 65W of power, with an N100 and 2 disks (+nvme boot disk) on plain ubuntu server. I plan to get it to less than 20W when idle, sure seems I can when checking various blog posts. Processing power isn’t a big deal for this server as it only received backups from the other servers and computers we use.
So I bought the hardware, setup the server and noticed the disks were always running when I had it next to me.
I spent days searching the web, trying various sleep commands. Eventually I found the sudo hdparm -Y /dev/sda
which forced the disk to sleep… for 1 second before it came back to life.
Eventually I found a command sudo btrace /dev/sda
that told me a ‘ext4lazyinit’ was writing to the disk frequently, led me to https://www.linuxquestions.org/questions/linux-general-1/someone-please-explain-ext4lazyinit-to-me-4175658874/ and https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bfff68738f1cb5c93dab1114634cea02aae9e7ba and it all makes sense.
A new file system needs initialising, and that takes time. So now, I’ve reinstalled ubuntu 22.04 for the nth time and this time I’m going to leave it running a week and see if the drives sleep.
Current power usage is between 30W and 35W.
… it will be easy, once it’s working.
Update April 2024: It is now using 18W when idle. It has been difficult working out if a disk is sleeping or idle, complicated by the 2 disks being from different manufacturers and not responding to hdparm (I forget the how and why, will update the commands I need to check status when I next get to look at this). I think I might be able to get to 12W or less…
Leave a Reply