Re: Hooks for automount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2021-03-10 at 22:35 +0800, Ed Greshko wrote:
> 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.

A couple of things:

1) I used fstab because the systemd.mount man page suggests it's the
preferred method, but that may be my misunderstanding. As I said
before, I find the systemd docs a real challenge to read. No doubt they
are correct, but they remind me of something we used to say about the
UNIX man pages back in the 70s: in order to understand one of them, you
just have to read all the other ones first.

2) I've only now noticed that findmnt gives an output line even when
the device is not mounted (the filesystem type is listed as 'autofs').
My fault for not looking more carefully.

Finally, without me doing anything at all except leave the system alone
for a few hours, it has suddenly started working. Go figure.

I now have to work out where to put the ExecStart/Stop lines.

poc
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux