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 support 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 is started on the client machine also.

/etc/init.d/portmap start
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