Difference between revisions of "Fstab - Use SystemD automount"
Views
Actions
Namespaces
Variants
Tools
imported>Excalibur1234 (removed spam link) |
m |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
__TOC__ | |||
{{SectionTemplate|<translate><!--T:1--> Introduction</translate>| | |||
<translate> | |||
<!--T:2--> | |||
I found a combination of systemd options (on the ArchWiki [https://wiki.archlinux.org/index.php/Systemd#Automount]) that can be used in the /etc/fstab when mounting storage devices --be they internal, external, or network shares. | I found a combination of systemd options (on the ArchWiki [https://wiki.archlinux.org/index.php/Systemd#Automount]) that can be used in the /etc/fstab when mounting storage devices --be they internal, external, or network shares. | ||
<!--T:3--> | |||
The magic (to me) that these mount options bring is that if a network share or an external drive that is being called via /etc/fstab is not present, they save your machine from hanging for a minute or two during the boot process. | The magic (to me) that these mount options bring is that if a network share or an external drive that is being called via /etc/fstab is not present, they save your machine from hanging for a minute or two during the boot process. | ||
<!--T:4--> | |||
A device called this way via /etc/fstab is mounted the first time data is attempted to be accessed from it. Only on this first mount is there any (minor) noticeable delay, when compared to having the device mounted the "old" way. | A device called this way via /etc/fstab is mounted the first time data is attempted to be accessed from it. Only on this first mount is there any (minor) noticeable delay, when compared to having the device mounted the "old" way. | ||
</translate>}} | |||
< | {{SectionTemplate|1=<translate><!--T:5--> A suitable problem example</translate>|2= | ||
<translate> | |||
<!--T:6--> | |||
I have a ReadyNAS Duo v1, which is connected to my LAN. These days I quite often turn it off as it doesn't need to run perpetually. | I have a ReadyNAS Duo v1, which is connected to my LAN. These days I quite often turn it off as it doesn't need to run perpetually. | ||
<!--T:7--> | |||
A problem that this causes is that if I forget to comment out the NFS share(s) that I'm using from the /etc/fstab file, I have to wait for a minute or two during the boot process whilst the system repetitively tries to make a connection. | A problem that this causes is that if I forget to comment out the NFS share(s) that I'm using from the /etc/fstab file, I have to wait for a minute or two during the boot process whilst the system repetitively tries to make a connection. | ||
I attempted to get AutoFS to work for me. I got close but I just wasn't allowed to see the files on the NFS NAS share. | <!--T:8--> | ||
I attempted to get AutoFS [https://wiki.manjaro.org/index.php?title=Using_autofs_(automount)_with_NFS]to work for me. I got close but I just wasn't allowed to see the files on the NFS NAS share. | |||
<!--T:9--> | |||
So then I found the following extremely simple & effective solution. (Wish I had of done this one first, as it would have saved me a couple of hours of a loosing battle!) | So then I found the following extremely simple & effective solution. (Wish I had of done this one first, as it would have saved me a couple of hours of a loosing battle!) | ||
</translate>}} | |||
< | {{SectionTemplate|1=<translate><!--T:10--> How do you do use it?</translate>|2= | ||
<translate> | |||
<!--T:11--> | |||
Add the following to the beginning of the options section in your /etc/fstab, the numbers at the end are a time limit for how long it should try to make a connection before giving up & moving on: | |||
<!--T:12--> | |||
{{File|file=/etc/fstab|content=<pre>noauto,x-systemd.automount,x-systemd.device-timeout=10</pre>}} | |||
<!--T:13--> | |||
After I added the above to the following line in my fstab: | After I added the above to the following line in my fstab: | ||
192.168.1.15:/media-2 | <!--T:14--> | ||
{{File|file=/etc/fstab|content=<pre>192.168.1.15:/media-2 /mnt/NAS-media-2 nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,hard,intr,noatime 0 0</pre>}} | |||
<!--T:15--> | |||
I could boot Manjaro whilst the ReadyNAS' Cat-6 network cable was unplugged, & there was NO noticeable delay. After the system was booted, I plugged the cable in & then called the NFS share /media-2 in Worker & it read the drive & listed the contents. | I could boot Manjaro whilst the ReadyNAS' Cat-6 network cable was unplugged, & there was NO noticeable delay. After the system was booted, I plugged the cable in & then called the NFS share /media-2 in Worker & it read the drive & listed the contents. | ||
<!--T:16--> | |||
After that I unplugged the drive, which had Worker (my file manager of choice) looking for it as I hadn't changed out of the the media-2 directory. When I plugged the cable back in, it took ~10 seconds or so & then Worker automatically re-listed the contents or this very large partition that has well over 2000 directories, each holding multiple files. | After that I unplugged the drive, which had Worker (my file manager of choice) looking for it as I hadn't changed out of the the media-2 directory. When I plugged the cable back in, it took ~10 seconds or so & then Worker automatically re-listed the contents or this very large partition that has well over 2000 directories, each holding multiple files. | ||
</translate>}} | |||
< | {{SectionTemplate|1=<translate><!--T:17--> Speed up your boot</translate>|2= | ||
<translate> | |||
<!--T:18--> | |||
If you have a very large /home & the boot process is held up when a scheduled fsck takes place (really not a big problem if you are using ext4), you can add the '''x-systemd.automount''' section to the options section of the line in your fstab for /home like so: | If you have a very large /home & the boot process is held up when a scheduled fsck takes place (really not a big problem if you are using ext4), you can add the '''x-systemd.automount''' section to the options section of the line in your fstab for /home like so: | ||
UUID=<id.number> /home noauto,x-systemd.automount,ext4 defaults 0 1 | <!--T:19--> | ||
{{File|file=/etc/fstab|content=<pre>UUID=<id.number> /home noauto,x-systemd.automount,ext4 defaults 0 1</pre>}} | |||
<!--T:20--> | |||
This will allow services that do not depend on /home to start while /home is checked by fsck. Mounting /home when it is first accessed, the kernel will buffer all file access to /home until it is ready. | This will allow services that do not depend on /home to start while /home is checked by fsck. Mounting /home when it is first accessed, the kernel will buffer all file access to /home until it is ready. | ||
</translate>}} | |||
[[Category:Contents Page{{#translation:}}]] | |||
[[Category:Contents Page]] |
Latest revision as of 14:34, 22 September 2021
I found a combination of systemd options (on the ArchWiki [1]) that can be used in the /etc/fstab when mounting storage devices --be they internal, external, or network shares.
The magic (to me) that these mount options bring is that if a network share or an external drive that is being called via /etc/fstab is not present, they save your machine from hanging for a minute or two during the boot process.
A device called this way via /etc/fstab is mounted the first time data is attempted to be accessed from it. Only on this first mount is there any (minor) noticeable delay, when compared to having the device mounted the "old" way.A problem that this causes is that if I forget to comment out the NFS share(s) that I'm using from the /etc/fstab file, I have to wait for a minute or two during the boot process whilst the system repetitively tries to make a connection.
I attempted to get AutoFS [2]to work for me. I got close but I just wasn't allowed to see the files on the NFS NAS share.
So then I found the following extremely simple & effective solution. (Wish I had of done this one first, as it would have saved me a couple of hours of a loosing battle!)noauto,x-systemd.automount,x-systemd.device-timeout=10
After I added the above to the following line in my fstab:
192.168.1.15:/media-2 /mnt/NAS-media-2 nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,hard,intr,noatime 0 0
I could boot Manjaro whilst the ReadyNAS' Cat-6 network cable was unplugged, & there was NO noticeable delay. After the system was booted, I plugged the cable in & then called the NFS share /media-2 in Worker & it read the drive & listed the contents.
UUID=<id.number> /home noauto,x-systemd.automount,ext4 defaults 0 1