zfs icon indicating copy to clipboard operation
zfs copied to clipboard

Faster wakeup from standby

Open Anuskuss opened this issue 2 years ago • 3 comments

I don't know if HDD standby/spindown is discouraged by ZFS devs or even dangerous but electricy is as expensive as ever and at least for me the money saved makes it worth it:

Wakeup¹ Energy Cost² Savings
Performance (-B 254) 0.133s 65 W 181.71 €
Power (-B 1) 6.315s 50 W 139.78 € 41.93 €
Standby (-B 1 -S 1) 42.061s 31 W 86.66 € 95.05 €

¹ time ls -la /zfs ² 24/7 * 0.32 €/kWh (minimum cost)

So back to the issue: ZFS seems to wake up the drives sequentially, which I guess makes sense if you're trying to wake up the least amount of drives as possible, but because I'm using RAID-Z2, it's highly unlikely that any drive can continue sleeping.

If I instead wake them up beforehand

for d in /dev/sd?; do sudo dd if=$d of=/dev/null bs=1 count=1 & done; time ls -la /zfs

it goes down to 8.776s. Still bad but also still worth it I think.

Edit: I'm not actually crazy enough to use -S 1 (standby after 5 seconds).

Anuskuss avatar Jan 09 '23 03:01 Anuskuss

I'm also running raid-z2 (2 vdevs with 16 drives) and put them to sleep after 45 minutes. So I would very much welcome a change to wake them at once. @Anuskuss - Thank you for the idea for the wake up script!

AllKind avatar Jan 12 '23 09:01 AllKind

It seems someone made a utility to do this as a workaround:

  • https://forum.proxmox.com/threads/zfs-on-linux-zpool-disk-spin-up-daemon.162433/
  • https://github.com/geppi/zolspinup

Please check if the repo is safe before using it. But be aware that if you are currently using hd-idle, this script might duplicate its efforts for zpool disks.

Also, it would be much nicer if the functionality would be part of ZFS, because it really looks like a bug.

mpeter50 avatar May 31 '25 02:05 mpeter50

Thanks for the link @mpeter50 - that sounds exactly like what I need. I'll check it out later.

Anuskuss avatar May 31 '25 17:05 Anuskuss