you might be able to do this:
echo 1 > /sys/block/sdX/device/delete

that will remove the sdX device, to get it back you would need to
reboot or do a"
echo "- - -" to the "scan" device under the device that controls it to
bring it back.

You may need to also use smartctl and/or hdparm (if this usb device
will pass the commands through)
to set the power down parameters on the disk so that it will power down.

On Wed, Jun 3, 2020 at 4:47 PM Patrick O'Callaghan
<pocallag...@gmail.com> wrote:
>
> On Wed, 2020-06-03 at 11:24 +0100, Patrick O'Callaghan wrote:
> > On Wed, 2020-06-03 at 08:33 +1000, Cameron Simpson wrote:
> > > On 02Jun2020 10:57, Patrick O'Callaghan <pocallag...@gmail.com> wrote:
> > > > I have a powered USB dock with a couple of SATA drives configured as
> > > > RAID1, and used only for nightly backups. The (minimal) manual for the
> > > > dock tells me it will power down after 30 minutes idle time, however I
> > > > don't see this happening. I presume that something (such as the md
> > > > system) is touching the drives periodically.
> > > >
> > > > What is the fstab option to have the drives mounted only when accessed?
> > > > This used to be automount (or autofs) but with systemd getting its
> > > > fingers into everything I know longer know how to do this.
> > > >
> > > > Can the drive be automatically unmounted if not in use? I presume this
> > > > would stop md from trying to check it and hence prevent the dock from
> > > > keeping it powered on.
> > >
> > > My own solution, here and at a client, is to have the backup script do
> > > the mount and umount. This has the advantage that the backups aren't
> > > even available for mangling the rest of the time. A script like this:
> > >
> > >     if mount /the/backup/volume
> > >     then
> > >       ... run the backup ...
> > >       umount /the/backup/volume
> > >     fi
> > >
> > > works nicely. The md stuff should, I expect, leave things alone except
> > > for the weekly(?) rescan.
> > >
> > > It also means that if you know the backup's over you can freely unplug
> > > them (eg put them on a shelf or in a drawer, or send one set off site).
> >
> > Good idea. I expect I'll want to use the drives for something else in
> > the future (they're nearly empty), which is why I wanted it to be
> > automatic, but for now it's a reasonable workaround.
>
> I've set that up and unmounted the drive, however the dock is not
> powering down as it's supposed to and 'lsblk' still shows the drives as
> present. It looks like something is keeping the USB socket powered up.
> I've tried using 'eject' on the drive units but I get 'Device or
> resource busy'. 'lsof' doesn't show any active processes.
>
> poc
> _______________________________________________
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
> Fedora Code of Conduct: 
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: 
> https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to