NFS/Client

From Gentoo Linux Wiki
< NFS
Jump to: navigation, search


Contents

[edit] Kernel Configuration

Enter the "make menuconfig" configuration screen and enable the following options:

Linux Kernel Configuration: NFS Client Support (2.6.27)
File Systems  --->
  [*] Network File Systems  --->
    <*>   NFS client support
      [*]    NFS client support for NFS version 3
      [ ]    NFS client support for the NFSv3 ACL protocol extension
      [ ]    NFS client support for NFS version 4 (EXPERIMENTAL)

Most systems are currently using NFS version 3. NFS version 4 support is optional, but shouldn't cause you any issues. If you opt to build NFS client support as a module, it will be called nfs.

[edit] Userspace Utilities

Once your kernel has updated (if needed) and you've booted into it, install the userspace utilities with:
emerge -av nfs-utils

[edit] Mounting the NFS Share

As root, mount the NFS share using the following command, where HOSTNAME is replaced with the IP address or hostname of the NFS server, /path/to/sharedDirectory is the directory to be mounted and /mnt/target is replaced with the location you want the share mounted. Make sure portmap (for nfs-utils < 1.2.x) or rpcbind (for nfs-utils >= 1.2.x) is started on the client machine.

For nfs-utils < 1.2.x:

/etc/init.d/portmap start

For nfs-utils >= 1.2.x:

/etc/init.d/rpcbind start
Note: Since version 1.2.x, nfs-utils does not use portmap anymore and emerge might complain about blocking issues. nfs-utils 1.2.x uses rpcbind and therefore, you can unmerge portmap. If something that you have installed complains about needing portmap you might try updating it from stable to the testing version also.

Now, we can mount the share itself:

mount -t nfs HOSTNAME:/path/to/sharedDirectory /mnt/target

For NFSv4, replace nfs with nfs4.

[edit] Fstab Entries

If you want users to be able to mount the share, or just for convenience, you can add an entry to /etc/fstab,

File: /etc/fstab nfs example
192.168.0.30:/mnt/music    /home/user/mnt/music    nfs    defaults,user,noauto    0 0

or use a hostname from your /etc/hosts file.

File: /etc/fstab nfs example
mediaserver:/mnt/video     /home/user/mnt/video    nfs    defaults,user,noauto    0 0

[edit] Automounting on Boot

If you want your fstab entries mounted on startup, remove noauto from the list of options in /etc/fstab and add nfsmount to the default runlevel:
rc-update add nfsmount default
Personal tools
In other languages