On 10/03/2021 20:57, Patrick O'Callaghan wrote:

[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?

My first thought is that you're doing things a bit different than what I did.

You have an entry for your disk in the fstab.  My understanding is that when an 
entry is in fstab mount unit
files will be auto generated.  I don't have fstab entries for my automounts.  I 
can't say that I know it is wise
to mix the methods.

Using my /aux as the example.  When unmounted I see...

[root@meimei ~]# findmnt /aux
TARGET SOURCE    FSTYPE OPTIONS
/aux   systemd-1 autofs 
rw,relatime,fd=53,pgrp=1,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=26036

But when mounted

[root@meimei ~]# findmnt /aux
TARGET SOURCE           FSTYPE OPTIONS
/aux   systemd-1        autofs 
rw,relatime,fd=53,pgrp=1,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=26036
/aux   nas:/volume1/aux nfs4 
rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,soft,proto=tcp6,timeo=600

I think I would first try removing (commenting out) the fstab entry and 
creating raid.mount file in /etc/systemd/system/
with the contents.

[Unit]
Description=mount raid

[Mount]

What=/dev/disk/by-uuid/6cb66da2-147a-4f3c-a513-36f6164ab581

Where=/raid
Options=rw,user
Type=ext4

[Install]
WantedBy=multi-user.target


At this time I've only used automounts for nfs mounts.  I'd try it with local 
disk if it weren't for the late hour.

Also, due to the late hour, I seem to recall seeing something about working 
with automounts and external devices
and conflicts arising due to the interference of udev.  But I may be mixing 
things.  So, I'd first see if making the
above changes has any effect.


--
People who believe they don't make mistakes have already made one.

_______________________________________________
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