[PATCH v3 10/10] ixp4xx: Add hdparm script

Andrey Jr. Melnikov temnota.am at gmail.com
Fri Oct 13 02:02:29 PDT 2023


Linus Walleij <linus.walleij at linaro.org> wrote:
> On Fri, Oct 13, 2023 at 12:28 AM Andrey Jr. Melnikov
> <temnota.am at gmail.com> wrote:
> > Linus Walleij <linus.walleij at 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.




More information about the openwrt-devel mailing list