Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What operating system is running on your Pi? If the lastest raspbian or other that uses systemd you can use its automounting feature instead. Stop autofs and add this to your /etc/fstab:
No, the x-systemd.automount option is basically the same thing as autofs except it does not create the mount directory. The noauto,_netdev options keep it from mounting at boot and waits until networking is up. The share is only mounted when the directory is accessed and automatically unmounted if the idle timeout has expired. x-systemd.device-timeout=10 determines how long to attempt a mount before moving on.
Thanks again for your answer and your clarification, Michael.
When I'm using the noauto,_netdev options and I'm using a bash-script (rsync backup to the NAS),
do I then have to wait for the mount in the script?
Here is a snippet of my backup-script, which I, unfortunately, never got to run due to the mounting problems
Do i still need the mount command, or will the mounting point automatically mounted at first access?
Code:
if ! mountpoint -q "${MOUNT_POINT}"; then
echo "Mount backup directory ${MOUNT_POINT}." >> "${LOG}"
if ! mount "${MOUNT_POINT}"; then
echo "Error on mounting. Backup will be cancelled!" >> "${LOG}"
exit 5
else
echo " Successfully mounted backup directory." >> "${LOG}"
fi
else
echo "${MOUNT_POINT} already mounted." >> "${LOG}"
fi
Me again
I now have changed to fstab and added an entry for the mountpoint on the NAS exactly how you told me.
After I rebooted the Pi the directory in /mnt/backup was not there.
I then changed the directory INTO the child dir, and after a while I saw the directories Hooray!
Unfortunately I don't have permission to browse into the subdirecties?!
Code:
insgesamt 36
drwxrwxrwx 5 root root 4096 Mai 27 20:20 .
drwxr-xr-x 3 root root 4096 Jul 11 19:48 ..
drwxrwxr-- 33 root root 4096 Mär 23 12:20 Pi2B
drwxrwx--- 5 root root 4096 Mai 27 19:19 Pi3A
drwxr-xr-x 3 root root 4096 Mai 1 20:26 rSync
pi@Pi2B:/mnt/nfs/backup $
pi@Pi2B:/mnt/nfs/backup $
pi@Pi2B:/mnt/nfs/backup $ cd Pi3A
-bash: cd: Pi3A: Keine Berechtigung
Which permission do I need in that case and do I have to edit these on the server
or must I create the directories, which I did now manually on the client, under
a different user? Or do I have to change the owner of the directories to make it work?
pi@Pi2B:/mnt/nfs/backup $ ls -la
insgesamt 36
drwxrwxrwx 5 root root 4096 Mai 27 20:20 .
drwxr-xr-x 3 root root 4096 Jul 11 19:48 ..
drwxrwxr-- 33 root root 4096 Mär 23 12:20 Pi2B
drwxrwx--- 5 root root 4096 Mai 27 19:19 Pi3A
drwxr-xr-x 3 root root 4096 Mai 1 20:26 rSync
pi@Pi2B:/mnt/nfs/backup $
pi@Pi2B:/mnt/nfs/backup $
pi@Pi2B:/mnt/nfs/backup $
pi@Pi2B:/mnt/nfs/backup $ cd Pi2B
-bash: cd: Pi2B: Keine Berechtigung
Here is the mount entry...
Code:
192.168.0.10:/Backup on /mnt/nfs/backup type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=14,retrans =2,sec=sys,mountaddr=192.168.0.10,mountvers=3,mountport=30000,mountproto=udp,local_lock=none,addr=192.168.0.10,_netdev)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.