Can systemd automounter unmount inactive fileystems?

Hi,
tl;dr: Can systemd automounter unmount fileystems after a period of inactivity, like autofs does?
I've just started discovering the wonderful new world of systemd, and to my great joy I found that it contains an automounter, so I thought that I would be able to use that instead of using autofs.
The single thing that I like to automount is my home NAS on my laptop (via NFSv4) that I every day take from home to work and then back home.
To do this with autofs is kind of like killing mosquitoes with a flamethrower. I would much rather just have my automounted NAS defined in my fstab than having to force the slightly mysterious autofs.xxx-files to mount the drive with the options I want it to use.
So, I got systemd to automount my NAS and all was joy! Until I realized that it wasnt unmounting it after a time of non-use. I have googled quite a bit, searched the forums, but have found no mention that systemd either has or doesnt have this kind of functionality.
So my purpose with this post is to get a definitive answer, does systemd do this? And if it doesn't, maybe others searching for the same information will end up here, and find the answer...
/DonO

I've been having this problem for as long as I can remember. I have finally decided to sit down and work something out instead of my laptop hanging all the time when it can't find the nfs server. The systemd.automount feature is nice, but it really sucks that it does not auto unmount when the share is not found.
Also, having systemd.automount means that every time I open vim, or a manpage, and there is no network connection, systemd tries to mount the shares. I'm not sure why because I am not directly accessing them. Everything loads slowly when systemd automount is active for my shares and there is no network connection.
Using soft instead of hard is a workaround, but then when the network connection is lost, corruption can occur.
It seems like the only way to really solve this problem is to have some kind of script run when the network comes up to mount the shares, and to unmount when it goes down. This would require custom systemd units or something. Diving into the systemd manuals is something I have been putting off because they are so hefty.
For anyone that is interested, here is my fstab:
lithium:/mnt/data /mnt/data nfs noauto,noatime,rsize=32768,wsize=32768,soft,retry=0,timeo=3,x-systemd.automount,x-systemd.device-timeout=1ms 0 0
lithium:/var/cache/pacman /var/cache/pacman nfs noauto,noatime,rsize=32768,wsize=32768,soft,retry=0,timeo=3,x-systemd.automount,x-systemd.device-timeout=1ms 0 0
Last edited by demizer (2013-07-14 09:00:23)

Similar Messages

  • X-systemd.automount nfs drive

    Hi,
    I can't seem to get systemd.automount to behave.  I have an nfs share available on machine 'kombi' and am trying to access it from machine 'forrest':
    [root@forrest ~]# showmount -e kombi
    Export list for kombi:
    /mnt/nfs4/georgia 192.168.1.202
    /mnt/nfs4 192.168.1.202
    It is set up to automount in /etc/fstab:
    kombi:/georgia /mnt/georgia nfs4 rw,suid,dev,exec,noauto,nouser,async,clientaddr=192.168.1.202,_netdev,x-systemd.automount,x-systemd.device-timeout=8 0 0
    Logging output from journalctl indicates it timed out but then mounted:
    Dec 14 17:45:11 forrest systemd[1]: mnt-georgia.mount mounting timed out. Stopping.
    Dec 14 17:45:11 forrest systemd[1]: Mounted /mnt/georgia.
    Dec 14 17:45:11 forrest systemd[1]: Mounted /mnt/georgia.
    However it is not mounted. Any process trying to access /mnt/georgia hangs.
    Any ideas where I have gone wrong?  I don't care if it automounts at boot or at first access.  What I'd like is for it to gracefully handle mounting when 'kombi' is up, and unmounting when 'kombi' is down.

    Thanks, I guess I have misread other advice on the forums.  Even systemd.mount man page states:
    If x-systemd.device-timeout= is specified it may be used to configure how long systemd should wait for a device to show up before giving up on an entry from /etc/fstab.
    From this statement I would expect the remote filesystem to not be mounted if the other machine is down, but not to cause a local process to hang trying to access the unmounted directory.
    It looks like autofs may be the way to go - from the NFS wiki:
    Using autofs is useful when multiple machines want to connect via NFS; they could both be clients as well as servers. The reason this method is preferable over the earlier one is that if the server is switched off, the client will not throw errors about being unable to find NFS shares.

  • X-systemd.automount and sshfs

    I've been using sshfs to access files on my pi for serveral months now. Today i tried to enable automatic mounting with x-systemd.automount, but although a manual mount is still possible, the automatic mount fails constantly with a "no such device" error since i added the additional option in /etc/fstab. Journalctl -f on the pi reveals that the "Connection is closed [preauth]", so I would guess that something is wrong with my client authenticating. But I don't understand how is this possible because I can in fact mount the partition manually. Even if I use the exact command used by systemd (found via ps -fe) with root it prompts me for the password of my key and then it mounts correctly. Shouldn't automount then prompt for my password, when my X starts? Any ideas?
    line in /etc/fstab:
    herrzinter-pi.local:/media/mediacrypt /home/herrzinter/Multimedia fuse.sshfs users,noauto,_netdev,reconnect,x-systemd.automount 0 0
    Last edited by MrTea (2013-07-01 15:34:13)

    WonderWoofy is right, until now I always used the automatically generated nautilus entry to mount the remote folder. In this case mount command is executed as <user> and so I don't need to put the additional information in the /etc/fstab. btw i didn't exactly look this up, but I've used this setup for quiet some time now, and I guess, that I forgot the herrzinter@ part once and noted that it worked anyway
    I now added this and the "IdentityFile=/..." option pointing to a dummy ssh key without passphrase and it then it's working, but I am not to happy with this, as an empty passphare key is not really nice, and also nautilus is showing me duplicated entries... but in genreal I have to look at the setup again I am not sure anymore if the x-systemd.automount option is really such a good idea in my case, as the network setup of my laptop is changing quite often... perhaps a bash script at login, or a custom systemd unit is better suited for my purpose
    Thank you all anyway

  • My daughter's ipod nano shows up in "devices" when I plug it in...but it disappears.  Right away it says it needs to update, but then after extracting the files it comes back and says that it can't be updated because it can't be unmounted.  help?!

    My daughter's ipod nano shows up in "devices" when I plug it in...but it disappears.  Right away it says it needs to update, but then after extracting the files it comes back and says that it can't be updated because it can't be unmounted.  help?!

    When in DFU mode and connected to the computer iTunes does not say anything but iTunes will see the iPod and you can restore the iPod via iTunes. When in recovery mode and you connect, iTunes will say it found an iPod in recovery mode.

  • Can't automount cd/dvdrom

    i already uncomment in /etc/fstab
    /dev/cdrom /media/cd auto ro,user,noauto,unhide 0 0
    /dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0
    but still can't automount in /media
    but i can manual mount.

    I was wondering if you got this working? I have had a look at the udev http://wiki.archlinux.org/index.php/udev page for more info, and it seems like you should maybe post the rules you made, since I don't think the rules have anything to do with the fstab, from what I could quickly get from skim reading the wiki.
    Last edited by oddsocks (2009-08-13 10:40:29)

  • Systemd automount luks partition in background

    A bit of a technical story for systemd experts.
    Systemd causes a few seconds delay on boot when it automounts all fstab entries and one of those entries is an encrypted volume. The problem is when I mount a data partition which is really not important, i.e. it can wait until the system is completely booted. I can fix this by using noauto in crypttab and fstab or I can use a rc.local script to mount the partition manually. But how can I tell systemd this partition is not important and mounting this partition should never delay booting? Is it even possible with systemd?
    /etc/crypttab:
    data /dev/... /root/data.key
    /etc/fstab
    /dev/mapper/data /mnt/data ext4 rw,relatime 0 0

    Thanks aesiris, I've tried this but it's the same. When I don't mount the encrypted data partition on boot the system goes from text mode to X within 2 seconds. If I do mount the data partition the console goes from text mode to framebuffer (not sure how to call it but when you got a higher resolution text console) and then to X. Guess what I want is not possible with systemd.

  • Systemd automount of /home results in locate ignoring /home

    Hi,
    Per the suggestion on the systemd wiki page, I have instructed systemd (via /etc/fstab) to automount /home. This is supposed to allow me to boot faster on those occasions when my /home needs to be fsck'ed. (Please correct me if I've misunderstood this point.) This results in "mount" reporting that my /home filesystem type is "autofs".
    This again results in locate ignoring my entire /home when indexing my harddisk, since the default /etc/updatedb.conf has PRUNEFS="(...) autofs (...)", i.e. it ignores all autofs filesystems. Now, I don't want to remove autofs from this list, since other filesystems that should be ignored (e.g. /proc/sys/fs/binfmt_misc) are of autofs type. I also would prefer to keep the automount trick from the wiki.
    Any suggestions as to how this can be accomplished? I have RTFM for updatedb.conf, and it does not have a "whitelist" of any sort. That would be the optimal solution, IMO, but requires an update from the mlocate maintainer upstream. Can I tell systemd to fake the filesystem type of home, or to pass on the actual filesystem type (ext4)?

    Here is another discussion of this issue: https://bbs.archlinux.org/viewtopic.php?id=154539
    Apparently the time savings provided by automounting /home may not be not significant enough to make it worthwhile. You can test this yourself, or continue with the other workarounds you are already aware of.

  • Bricked external Hard Drive, Can't Force Unmount or Erase

    I have manage to brick a 1TB Western Digital USB 3 drive. I have all my data backed up, so I just need to reformat and repartition it. No big deal typically, however it appears I've done something terrible to this particular drive. Here are the things I've tried and how they've failed:
    * Use Disk Utility to erase drive (multiple formats selected)
         * Disk Erase failed - Couldn't unmount disk
    * Force unmount using terminal command "sudo diskutil unmountDisk force /dev/disk3
         *Failed - unable to unmount disk
    * Restart in safe mode and attempt to force unmount disk using same terminal command
         *Failed - unable to unmount disk
    * Restart in recovery, launch terminal, attempt to force unmount disk using same terminal command
         * Failed - unable to unmount disk
    * While in recovery terminal, attempt to erase disk using "diskutil eraseVolume JHFS+ NewDisk /dev/disk3"
         * Failed - couldn't unmount disk
    * While in recover terminal, attempted to erase individual partitions using "diskutil eraseVolume JHFS+ NewDisk disk3s2"
         * Failed -Different error this time!!! - Couldn't open disk
    Apparently, the entirety of the internet is out of ideas at this point, or at least no one has ever had this level of trouble before now. Any help anyone is willing to offer is much appreciated. If I have to take the hard drive apart and move some dip switches - whatever. At this point I just want to solve this on principle, as the drive has no physical damage, just a jacked up partition that is, apparently, un-erasable. I'm losing my mind a little bit, because I can't think of good reason for why this could happen. Thanks in advance

    Have you tried DiskWarrior? A few years ago it worked for me and they keep it updated.

  • Limited searching on Group share, can't automount

    Hi, OS X Server newbie here, but I'm starting to get a decent feel of how things work.
    I have set up OD and the client computers up with mobile accounts that store their home directory locally but still allow authentication. I lumped the appropriate users into a group, say "officegroup", with their own share, /Groups/officegroup.
    Now, once clients log in to their workstation, I cannot get the group share to automount. To access it I have to go through Finder, enter the username and password, and it works fine. I thought that upon login, authentication would be good to go to access other services and the user would not have to enter their username and password in again. I've checked DNS (dig, dig -x, -checkhostname, etc.), and everything checks out fine and says that it's all being resolved correctly. So, what am I missing?
    Second, it seems that searching is limited in the group share. If I search for something, only folders come up, but no files. Spotlight is enabled on the share, I've rebuilt the indexes with mdutil, but nothing changes. Any ideas?
    Thanks,
    Nate

    I wanted to write what I found out in hopes of helping someone else who uses OS X Server and isn't as experienced as some people who contribute here. When I upgraded to 10.4, I was using Netinfo domain and Open Directory to bind my clients to the server. In WGM I had to authenticate to LDAP, for reasons I still don't completely understand. I wasn't however, correctly using LDAP for authentication across my network.
    I used Server Admin to migrate my Netinfo domain to LDAP in Open Directory. Then I turned on DHCP in OS X Server and turned off DHCP on my router. Then I used DIrectory Access to configure LDAP to use DHCP-supplied addresses and added an entry for my server. I disabled Netinfo on each client once I verified that this worked.
    Once this was done the automounts showed up in the correct location as specified in WGM. And no, you don't have to create the folders on the client machines. In addition, my authentication for my users has been fixed to use LDAP properly (well, at least as far as I can tell at this point).
    All of this info is in the Open Directory and Authentication Manual. The lesson I learned is that the OD stuff has to be properly configured otherwise services that depend on it will not perform quite right. What's scary is that I used this half-baked configuration since I installed Tiger a long time ago. I run a simple server-based enironment in my house, so I never picked up on the inconsistency.

  • How can I automount Time Capsul

    I have a Time Capsule on my home network that I use, not only for backups (Time Machine on Mac and Norton 360 on PC), but also to store all my media.
    I have setup iTunes on my iMac and both my PCs to access the media on the Time Capsule. This works really well. I have no issues at all with my PC's access to the Time Capsule the problem is with my iMac.
    On my iMac the only way I can ensure that iTunes can access the media on the Time Capsule is to first open a Finder window and browse the directory tree to my media folder. After I have done this once there is no issue, but if it is not done (for example my wife plugging her iPhone in to synch just after logging in) iTunes says all of the media on the Time Capsule is in accessible. To remedy this I have to then exit iTunes, do the Finder thing and then restart iTunes.
    I guess the issue is caused by the iMac not automatically mounting the Time Capsule disk. If this is the case, is there any way that I can configure my iMac to automount the drive so I don't need to open it in Finder before I access it with anything else?
    TIA
    Grant.

    Hi,
    Just found this on another forum. It worked for me.
    Yeah, that's actually really easy. Time Capsule runs a Samba server and an AFS (Apple File Sharing) server in the background. You can connect to it using the "Connect to Server" feature in the Finder. I assume you've already used the Airport Setup Utility to configure your Time Capsule for file sharing. If not, do that first.
    Then, use the Finder's "Connect to Server" feature:
    Finder > Go > Connect to Server
    Next, enter the address of your Time Capsule's AFS server in this format:
    afs://192.168.1.1
    When you click "connect" it will prompt you for a username and password. Use the login information that you entered when you set up your Time Capsule. A finder window will appear, giving you access to the Time Capsule's disk.
    Depending on which version of OS X you're running, it may or may not have put an icon on your desktop for the mounted disk. You can fix this by checking the "Connected Servers" checkbox in: Finder > Preferences > General
    To make it mount the disk automatically every time you log in, add a login item to your account. Go to:
    System Preferences > Accounts
    Click on your user and select the "Login Items" tab. Click the plus sign to add a login item and choose the Time Capsule Volume you just mounted.

  • How can I automatically unmount my Windows partition in OSX?

    Hey guys,
    I have been having general performance slow down while in OSX since I (partitioned and) installed Windows 7 (onto the iMac below).
    A couple of times, when I have been using OSX, I have found that if I unmount the Win 7 partition, then OSX will run faster and better.
    Is there any way that I can automatically unmount the partition on startup/login? I do not mind if it is a script or something else I need to do/use, as the performance is becoming rather frustrating.
    Thanks, Lib.

    Hi,
    have a look at the answers in this thread http://discussions.apple.com/thread.jspa?threadID=1984633&tstart=0
    For starters, it might be sufficient to boot into WIndows a rename the Windows partition using the WIndows Explorer to something starting with a dot (e.g. .Windows).
    OSX usually ignores partitions that start with a dot.
    Regards
    Stefan

  • How can I delete old & inactive user account datawith a script?

    there is a mac 10.4 server that has many old user folders. too many to delete one by one. there is no grouping of users. all of them are in the /user folder
    I want a script that will check the folders in the /user direcotry against the OD users. If a user for that folder does not exist then it will rm or move to trash or an /inactive users or /olduser folder.
    thanks for any help
    it is the same question in this thread but was not answered really well at all
    http://discussions.apple.com/thread.jspa?threadID=1081185&tstart=0

    Well, the problem with rm the folder is that it still leaves data hanging around (profile, home drive, etc.) I was really hoping for something that would sweep up everything from people that are no longer in the OpenDirectory database.
    Anyway, I'll close this question by saying thanks for trying.
    Later...
    Richard

  • How can I reactivate the inactive part in my system memory

    My iMac freezes because of the large inactive part of the system memory

    That's not why your Mac is freezing. In the old days you could assign a block of memory to individual applications. That is no longer neccessary as memory is now allocated on the fly. Your inactive memory will be used as needed.

  • Can not get past "inactive" on airport?

    Yep, can not turn airport active in Network prefs, "Turn Airport ON" button is grayed out. I believe this started w/ 10.5.8. My Mac pro is connected to airport w/ ethernet (bridged from a Linksys --ya know the linksys never has problems, it just runs -- what giver w/ apple's superiorty -- airport problems and printing problems just seem common w/ OS updates?), but I have to get on one of the other mac in the house have normal access to the airport.
    I have trashed airport prefs in system config, hard reset the airport, but really no change? Thanks

    I have the same problem since switched from Leo to Snow Leopard. Apple has a bug that trashes our work with the MAC.

  • [Solved] Systemd automounts /boot (was mlocate not traversing /boot)

    For some reason, mlocate does not index my /boot:
    ┌─[Shiv ~ ]
    └─╼ locate vmlinuz-linux
    /home/jason/Build/chroot/root/boot/vmlinuz-linux
    ┌─[Shiv ~ ]
    └─╼ sudo updatedb -U /boot
    [sudo] password for jason:
    ┌─[Shiv ~ ]
    └─╼ locate vmlinuz-linux
    /boot/vmlinuz-linux
    /boot/vmlinuz-linux-jwr
    ┌─[Shiv ~ ]
    └─╼ sudo updatedb
    ┌─[Shiv ~ ]
    └─╼ locate vmlinuz-linux
    /home/jason/Build/chroot/root/boot/vmlinuz-linux
    My /etc/updatedb.conf is the stock Arch one, /boot is obviously mounted (as the -U switch works), but a plain updatedb does not return any results from /boot.
    I recently moved my ESP from /boot/efi to /boot, and as this is the only machine exhibiting this behaviour, it leads me to suspect something is amiss here.
    My fstab:
    # ESP: /dev/sda1
    UUID=696A-09B3 /boot vfat defaults,relatime,discard 0 2
    # /dev/mapper/vgroup-lvroot
    UUID=1d2dfd7d-adeb-4786-ag98-c8fg675f8e2f / ext4 rw,relatime,discard,data=ordered 0 1
    # /dev/mapper/vgroup-lvhome
    UUID=50798021-94b5-4011-a593-9087gfhcd59b8 /home ext4 rw,relatime,discard 0 2
    Am I missing something obvious?
    # edit: updated thread title with the cause, as opposed to the symptom...

    WonderWoofy wrote:There is a mechanism in systemd (or maybe gummiboot) that mounts the ESP on /boot as a systemd autostart unit.  So it shows up as autofs, which mlocate does not venture into.
    Bingo!
    ┌─[Shiv ~ ]
    └─╼ mount | grep boot
    systemd-1 on /boot type autofs (rw,relatime,fd=36,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
    /dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro,discard)
    falconindy wrote:If there's one thing I've learned about remote debugging over the years, it's to not trust people.
    Especially Antipodeans
    lolilolicon wrote:I Googled for this and found this relevant talk in our (duh) wiki
    I spent some time yesterday searching, but missed this--to my shame
    65kid on the wiki wrote:* this feature isn't even documented in systemd yet
    Great. Any way to suppress this?

Maybe you are looking for

  • Excise invoice SL No not coming

    Dear Guru In SAP at the time of Outgoing Excise Invoice Serial No.generating (TCODE-J1IIN) some times  instead of regular SL No. it generate different No. How it possible, this is client issue. Thanks in advance Satya

  • Hooking up to DVI on HDTV?

    Hi,    I don't know that much about computers.  I have a Lenovo 3000 J115 and I'm wondering how to hook it up to my HDTV.  I have a DVI port on the back on my tv, but don't know how to go about connecting it from the computer.  Could someone please g

  • Linkage of Different Transactions in eCATT.

    Hi , I would like to understand how can we link different transactions for testing a cycle in eCATT. I am aware that we can link two transactions based on the output of the first. For example: Message output of Sales order can be used as input for De

  • T/X model SORTing Find/Search results from Most Current Entry

    Have the Palm T/X model, and use the FIND/search function constantly. The results always come up from the earliest (oldest) entry to the most current. This is a major league pain-in-the-butt especially when there are tons of entries to go thru to get

  • Hide "All values" in input controls?

    Hey guys, I'm wondering that I could not find my question already in this forum but however - this is my question: Isn't it possible to hide the value "All values" in the input controls? In some cases it just doesn't make sense to leave that into the