Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
I need to delay the mount of my NFS shares until after my wlan0 connects to the network. Exactly like this thread, http://ubuntuforums.org/showthread.php?t=1491137
I have searched and found many options I don't understand.
I have a NAS running Freenas 8.3.1 it has 2 pools and 2 NFS shares
share 1 is named 'media' path 192.168.2.xx:/mnt/media
share 2 is named 'music' path 192.168.2.xx:/mnt/music
I have created only 1 user (me) in Freenas.
I have installed autofs but can't figure out how to set it up.
My mount points are /home/travis/Videos/Movies and
/home/travis/Music
these are the paths I've mapped for xbmc and the folders I use to manage the content.
I know I need to add to the auto.master something like this
/home/travis/Videos/Movies /etc/auto.Movies
/home/travis/Videos/Music /etc/auto.Music
/mnt yp:mnt.map
so my auto.master looks like this
Code:
/home/travis/Videos/Movies /etc/auto.nfs
/home/travis/Videos/Music /etc/auto.nfs
/mnt yp:mnt.map
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/home/travis -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/nfs /etc/auto.nfs
what I don't get is what next.
I know I need the IP address and the mount points for the shares somewhere so autofs knows where the files are.
I am trying to follow this but I don't really want the root directory mounted. https://help.ubuntu.com/community/Autofs
Code:
Now we will create the file which contains our automounter map:
$ sudo nano /etc/auto.nfs
This file should contain a separate line for each NFS share. The format for a line is {mount point} [{mount options}] {location}.
If you have previously configured static mounts in /etc/fstab, it may be helpful to refer to those.
Remember, the mount points specified here will be relative to the mount point given in /etc/auto.master.
The following line is for shares using older versions of NFS (prior to version 4):
server server:/
This creates a new mount point at /nfs/server/ and mounts the NFS root directory exported by the machine whose host-name is server.
4.2.1. NFSv4
If your NFS shares use NFSv4, you need to tell autofs about that. In such a case, the above line would appear as follows:
server -fstype=nfs4 server:/
The client needs the same changes to /etc/default/nfs-common to connect to an NFSv4 server.
In /etc/default/nfs-common we set:
NEED_IDMAPD=yes
NEED_GSSD=no # no is default
So after rebooting all the things I did corrupted something to the point where I could do nothing because ALL permissions for Casa(?) were changed. I kept getting the error message about needing read/write permissions. then Mint menu wouldn't come up. alt f1 poped it up on the desktop but anything I selected wouldn't open.
I couldnt even get to a terminal. I had to boot from my emergency thumb drive and rename my auto.master, auto.misc, and auto.nfs to get the box to boot.
note the use of fsid=#### and that all three shares are using different fsid's. for NFSv4 you only need the single mount point. in my case /exports from there everything else is mounted and accessed via fully qualified paths on the client side, or they can just mount /exports as their share and see all of the directories under /exports.
lleb thank you for your quick response. I think I understand but, I have multiple shares. Do I need an entry for each share? Also I'm not quite sure about the exports part.
I don't recall reading anything about this. I don't have an 'exports' in etc though it's easy enough to make.
I googled but couldn't find out what version of NFS freenas uses I was assuming for now it is v4. As far as configuring it correctly i found nfs4-acl-tools but have no idea how to use them. I do know I can mount the shares with sudo mount though.
and here is an excerp from another discovery that answered a gnawing question.
"Configuration"
The configuration is done with the help of 2 files. The auto.master file, holding the mount points, and a mount point file providing the system options for this specific mount point.
Assuming your main purpose to delay services, what about considering systemd? Migration might be painful at the beginning but the mechanism will give you the power that you need.
I have lots of services that requires internet connection, by using systemd I can easily execute them with reference to other services.
lleb thank you for your quick response. I think I understand but, I have multiple shares. Do I need an entry for each share? Also I'm not quite sure about the exports part.
I don't recall reading anything about this. I don't have an 'exports' in etc though it's easy enough to make.
I googled but couldn't find out what version of NFS freenas uses I was assuming for now it is v4. As far as configuring it correctly i found nfs4-acl-tools but have no idea how to use them. I do know I can mount the shares with sudo mount though.
Thanks again
get into the FreeNAS system and look around as root. without /etc/exports there is no NFS being provided by the server. You have to know that information before you can mount the share on the workstations.
the version the server is running is as important as how it is exported with permissions and fsid (file system ID)
the only reason for using the bg option on the workstation side is if there is an issue with mounting the share it will not stall the boot cycle or cause the workstation to have "lag" issues from time to time. I mainly use that as I have several laptops in my LAN. the bg is great for them as when autofs tries to kick in and load the shares if they are not home, it has zero effect on their performance.
I had to use the web GUI to root around be cause of this warning. http://img5.imageshack.us/img5/9526/sshwarning.png
I am pretty sure it because of all the changes (including a complete new install of freenas) I've been doing.
I do not have an exports file in etc/. I went through all directories and couldn't find it. I did find 3 other etc/'s as sub directories though.
The version (of what?) of freenas I am running is 8.3.1 and I haven't been able to figure out what version of NFS it has.
I definitly want the bg option.
OOOPs...... So, I went back and ran ssh-keygen -f so I could get in and look around and it turns out the shell through the web GUI wasn't showing me all the contents of the directories. This means that there might have been a properly configured exports file present. I however just nano'd one and added a comment to be able to save the file. (I guess I erased whatever it said before) so again OOOPs.......
I guess I'll delete the shares and make them again and see if it fixes the problem.
Sorry it's taken so long to get back but life happens. Yes I know they're read only. I did it on purpose for now. I'd hate to accidently delete my data while messing with the machines.
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
#/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#/mnt yp:mnt.map
#/home/travis/Videos/Movies /etc/auto.nfs
#/home/travis/Videos/Music /etc/auto.nfs
/nfs /etc/auto.nfs
+auto.master
These are just the main locations of the shares. There are sub directories (i.e. mnt/media/Movies and mnt/Music/Tunes) do I need to add the full path to the shares?
I'm still not sure about this next part. Mainly where the entry goes.
part 4.2.1. NFSv4 of the tutorial above
"If your NFS shares use NFSv4, you need to tell autofs about that. In such a case, the above line would appear as follows:
server -fstype=nfs4 server:/"
Also here is my fstab that can't mount because of the wlan0 issue.
Code:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=5d2a547b-f5e5-478e-83bf-eac5bb5e8e0d / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb1 during installation
UUID=f017573b-6b14-4b5e-924c-c27fb978158f none swap sw 0 0
#mount 192.168.xxx.xxx:/mnt/media/Movies /home/travis/Videos/Movies nfs auto rw,hard,intr 0 0
#mount 192.168.xxx.xxx:/mnt/media/Series /home/travis/Videos/TV nfs auto rw,hard,intr 0 0
#mount 192.168.xxx.xxx:/mnt/Music /home/travis/Music nfs auto rw,hard,intr 0 0
#mount 192.168.xxx.xxx:/mnt/media/storage /home/travis/Nas nfs auto rw,hard,intr 0 0
Mind you at the moment all the pertinant entries are commented out so I don't destroy my 4th install from trying to get autofs working.
My last step was to run:
Code:
travis@XBMCenter ~ $ ls /nfs/server
and the result was:
Code:
ls: cannot access /nfs/server: No such file or directory
It's based on where this entry goes and how it's formatted.
"server -fstype=nfs4 server:/"
Is anyone willing to share their auto.master, any auto.xxx, exports, and etc/default nfs-common entries as an example of a working autofs set up?
It's kinda working. I was afraid I would corrupt my installation again but I did eventually try with and without the bg option. I get the directories generated or if they already exist they are used. There is an icon of a lock on each folder and when I open the folder, it's empty. I can sudo mount and I have changed the permissions to my shares so I can write to them as well and they are ok. Google here i come!!!
Do I need to add my HTPC to the hosts file on my server?
Here it is:
Code:
# $FreeBSD: src/etc/hosts,v 1.16.34.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file. Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1 localhost localhost.my.domain freenas freenas.local
127.0.0.1 localhost localhost.my.domain freenas freenas.local
#
# Imaginary network.
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend
#
[ Read 33 lines ]
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.