

























Hi everyone, I'm currently converting an old-ish gaming pc into a sort of home server/NAS, it's all a lot of fun. There is a filesystem on there I want to mount to my laptop, but only when I'm at home. At the moment and for the foreseeable future, I won't be able to access this server over the internet.
To be able to quickly see if the file system is mounted, I'd like the mount directory to only exist when the FS is available. So whenever I'm not at home, there's no visible mount directory, when my laptop connects to my home's wifi, the directory gets created and the FS gets mounted, when I leave, the FS gets unmounted and the directory gets removed, if I'm at home, but the FS is inaccessible (like if the server were to be shut down), it gets unmounted and the directory gets removed.
So far, I've found no easy way to do this. The simplest way to mount the network drive seems to be using /etc/fstab, using the x-systemd.automount and either nofail or soft options. From what I understand, this will also prevent the network drive mount timeout from slowing down my boot. Using the x-mount.mkdir option, it seems like I can also have fstab automatically create the directory, which is almost what I want! It just doesn't remove the directory when the FS gets unmounted.
Does this sound possible? Maybe I'm coming at this from a completely wrong point of view. Does it even make sens to think of network file systems as "successfully mounted", or does my machine only check when it needs to access a file?
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。