christoph ender's


tuesday the 19th of september, 2023

simplest hd keep-awake

I've been trying to get some long-type smartctl tests to run through uninterrupted. Since they're taking about 11 hours for a 4TB hd – yes the old, spinning ones – these were so far always interrupted by the hd going to sleep. After looking at some measures to deactive the various sleep mechanisms I found the best and simplest one.

while true; do uptime > /mnt/my-hd; sleep 60; done

Just writing a tiny bit of data to the disk in question every minute or so will keep it awake as long as required without having to alter any of the various sleep / powersave parameters or having to restore these settings after the smartctl runs were through.