Dwight Baer
asked on
Ubuntu - how to automatically mount a resource
On my desktop (ubuntu) client machine, I need to mount some resources that are found on a server. I'd like this mount to happen every time the machine boots, automatically.
The command I'm running is:
(sudo) mount 10.10.1.57:/mnt/nfs/Deskto p /mnt/nfs/mnt/nfs
Thanks
The command I'm running is:
(sudo) mount 10.10.1.57:/mnt/nfs/Deskto
Thanks
which resources? you can use autofs
ASKER
The resources are just a bunch of files I'd like people to be able to access.
So ... I installed autofs
And I found a procedure at https://www.linuxtechi.com/automount-nfs-share-in-linux-using-autofs/
Comments on that procedure? Thumbs-up is all I think I need, it seems quite clear, thank you very much.
So ... I installed autofs
And I found a procedure at https://www.linuxtechi.com/automount-nfs-share-in-linux-using-autofs/
Comments on that procedure? Thumbs-up is all I think I need, it seems quite clear, thank you very much.
ASKER
Actually I think this is better: https://linuxize.com/post/how-to-mount-an-nfs-share-in-linux/#automatically-mounting-nfs-file-systems-with-etcfstab
ASKER
OK, I added the following in /etc/fstab:
10.10.0.57:/mnt/nfs/Deskto p /mnt/nfs nfs defaults 0 0
Now the resources are automatically mounted when the machine boots. Yeah ... I'm halfway there. Now I just need it to automatically unmount before shutting down. I'll dig into the autofs documentation again.
10.10.0.57:/mnt/nfs/Deskto
Now the resources are automatically mounted when the machine boots. Yeah ... I'm halfway there. Now I just need it to automatically unmount before shutting down. I'll dig into the autofs documentation again.
This will be mounted for all users, autofs can mount your specific path.
much depends on your need. you said you wanted your resource to be available on login.
in the path, you have a typo, do you really need to nest the things
/mnt/nfs/mnt/nfs
do these mount points exist?
/mnt
/mnt/nfs
/mnt/nfs/mnt
/mnt/nfs/mnt/nfs
often, if you need a resource of your own, you would create it as part of your home dir ~yourusername/mnt
much depends on your need. you said you wanted your resource to be available on login.
in the path, you have a typo, do you really need to nest the things
/mnt/nfs/mnt/nfs
do these mount points exist?
/mnt
/mnt/nfs
/mnt/nfs/mnt
/mnt/nfs/mnt/nfs
often, if you need a resource of your own, you would create it as part of your home dir ~yourusername/mnt
once added run mount -a
this will trigger the mount of all things within the fstab without the need to reboot.
this will trigger the mount of all things within the fstab without the need to reboot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think
Using the procedure at https://www.linuxtechi.com/automount-nfs-share-in-linux-using-autofs/
It involves:
1. Adding the following line to /etc/auto.master:
/mnt/nfs /etc/auto.nfsdb --timeout=180
2. Adding the following line to /etc/auto.nfsdb:
/mnt/nfs -fstype=nfs4,r,soft/intr 10.10.0.57:/mnt/nfs/Deskto p
3. I started the autofs service:
sudo /etc/init.d/autofs start
But no joy ... it's not mounted.
Using the procedure at https://www.linuxtechi.com/automount-nfs-share-in-linux-using-autofs/
It involves:
1. Adding the following line to /etc/auto.master:
/mnt/nfs /etc/auto.nfsdb --timeout=180
2. Adding the following line to /etc/auto.nfsdb:
/mnt/nfs -fstype=nfs4,r,soft/intr 10.10.0.57:/mnt/nfs/Deskto
3. I started the autofs service:
sudo /etc/init.d/autofs start
But no joy ... it's not mounted.
ASKER
Yeah!!!
OK ... Thanks so much arnold for hanging in there. It works.
I abandoned autofs. No problem, I learned something.
mount -a worked.
And the key thing you said that was helpful was ... " no need for a special directive" - I'm assuming that it will unmount cleanly and properly when I do shutdown.
Thanks so much.
OK ... Thanks so much arnold for hanging in there. It works.
I abandoned autofs. No problem, I learned something.
mount -a worked.
And the key thing you said that was helpful was ... " no need for a special directive" - I'm assuming that it will unmount cleanly and properly when I do shutdown.
Thanks so much.
ASKER
I agree ... no need for /mnt/nfs/mnt/nfs - I reduced it to /mnt/nfs
ASKER
Thanks again