On Mon, 2021-03-01 at 03:27 +0800, Ed Greshko wrote:
> On 01/03/2021 01:12, Patrick O'Callaghan wrote:
> > Is there a way to invoke scripts before auto-mounting and after auto-
> > unmounting? I want to be able to power an external drive up and down as
> > needed.
> > 
> 
> Well, using systemd units that should be possible.  I use systemd to 
> automount nfs.
> For one in particular I have....
> 
> [egreshko@meimei system]$ cat aux.automount
> [Unit]
> Description=Automount Aux
> 
> [Automount]
> Where=/aux
> TimeoutIdleSec=60
> 
> [Install]
> WantedBy=multi-user.target

[Sorry for the long delay, but other stuff intervened.]

I've come back to this now and started experimenting incrementally. As
a first step, I just want to automount/unmount, ignoring the power-
on/off part for now, i.e. the device is already powered on. This is my
/etc/fstab entry:

   UUID=6cb66da2-147a-4f3c-a513-36f6164ab581       /raid                   ext4 
   rw,noauto,user,x-systemd.automount 0 0

and /etc/systemd/system/raid.automount (copied from your example):

   [Unit]
   Description=Automount /raid
   
   [Automount]
   Where=/raid
   TimeoutIdleSec=10
   
   [Install]
   WantedBy=multi-user.target
   
I've rebooted, and the device starts up mounted:

   # findmnt /raid
   TARGET SOURCE    FSTYPE OPTIONS
   /raid  systemd-1 autofs 
rw,relatime,fd=52,pgrp=1,timeout=10,minproto=5,maxproto=5,direct,pipe_ino=24910
   
though I'm not sure why as nothing is accessing it. It also remains mounted, 
despite the timeout.

Any thoughts?

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
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to