Linus Walleij <linus.wall...@linaro.org> wrote:
> On Fri, Oct 13, 2023 at 12:28 AM Andrey Jr. Melnikov
> <temnota...@gmail.com> wrote:
> > Linus Walleij <linus.wall...@linaro.org> wrote:

> > > This script will make sure to spin down harddrives on IXP4xx
> > > NAS devices such as the NSLU2 and siblings after 1 minute
> > > of inactivity.
> >
> > Why not use hotplug events?

> Could be a good idea! Do you have a pointer to how we do these
> in OpenWrt?

I'm use for external USB disk patched /etc/hotplug.d/block/00-media-change

-- cut /etc/hotplug.d/block/00-media-change --
[ -n "$DISK_MEDIA_CHANGE" ] && /sbin/block info

if [ "$ACTION" = "add" -a "$DEVTYPE" = "disk" ]; then
        case "$DEVNAME" in
                mtd*) : ;;
                *) echo 2000 > /sys/block/$DEVNAME/events_poll_msecs ;;
        esac
        case "$DEVNAME" in
                sd*) /sbin/hdparm -B 127 -S 120 /dev/$DEVNAME | /usr/bin/logger 
                ;;
        esac
fi
-- cut --

PS: And 60 seconds timeout for NAS disks is low. Readahead+cache and serve
small files (which fit in memory) - now disk's in spinup-read-spindown cycle.


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to