On Tue, Dec 1, 2020 at 9:39 AM Patrick O'Callaghan
<pocallaghan(a)gmail.com> wrote:
On Tue, 2020-12-01 at 14:52 +0100, Roberto Ragusa wrote:
> On 12/1/20 2:15 PM, Patrick O'Callaghan wrote:
> > I have a couple of SATA drives connected via a USB dock that I use only
> > for backups. Normally they are powered down and only come on at night
> > during the backup run. However they also power on any time I reboot the
> > system and have to be powered down again manually. I'd prefer not to
> > power them on at all until they're needed.
> >
> > Is there some magic that would inhibit the boot process from powering
> > up these devices? Note that the /etc/fstab entry already has 'noauto'
> > but that just prevents them from being mounted.
>
> How do you power them down?
Extract from my script ($SLOT is sd[de]):
smartctl --smart=off /dev/$SLOT1 -q errorsonly >> $LOG 2>&1
smartctl --smart=off /dev/$SLOT2 -q errorsonly >> $LOG 2>&1
echo 1 > /sys/block/$SLOT1/device/delete # Can't
use udisksctl because it removes the
echo 1 > /sys/block/$SLOT2/device/delete # bus, which
can't be powered on again
I've got a Seagate laptop drive inside an Intel NUC that is only
storage (not system boot or root). And I use a udev rule.
$ ls -l /etc/udev/
hwdb.bin hwdb.d/ rules.d/ udev.conf
$ ls -l /etc/udev/rules.d/
total 12
-rw-r--r--. 1 root root 139 Oct 7 17:47 60-block-scheduler.rules
-rw-r--r--. 1 root root 179 Oct 7 17:36 69-hdparm.rules
-rw-r--r--. 1 root root 628 Oct 29 06:40 70-persistent-ipoib.rules
$ cat /etc/udev/rules.d/69-hdparm.rules
ACTION=="add", SUBSYSTEM=="block", \
KERNEL=="sd*[!0-9]", \
ENV{ID_SERIAL_SHORT}=="WDZ47F0A", \
RUN+="/usr/sbin/hdparm -B 100 -S 252 /dev/disk/by-id/wwn-0x5000c500a93cae8a"
$
--
Chris Murphy