Network File System (NFS) is a file system protocol that allows client machines to access network attached filesystems. The newest version is version 4.

<A> Kernel requirements:

  NFS server support is not required for NFS clients, and NFS client support is not required for NFS servers. Dnotify support is only required for NFSv4. NFSv3 is only required for compatibility with legacy clients e.g.

File systems --->
[*
] Dnotify support
[*] Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version
<*> NFS client support for NFS version
[*] NFS client support for NFSv4.
<*> NFS server support
[*] NFS server support for NFS version
[*] NFS server support for NFS version
[*] NFSv4. server support for Parallel NFS (pNFS)

<B> Install "net-fs/nfs-utils"(Gentoo) or "nfs-utils.x86_64"(RedHat)

  After installation, set the "rpcbind" and "nfs" service start with your OS:

root # rc-update add nfs default && rc-update add rpcbind default
OR
root # systemctl enable nfs.service && systemctl enable rpcbind.service

<C> Virtual root

  The filesystems to be exported must be made available under a single directory. This directory is known as the virtual root directory, and it is required for NFSv4:

root #mkdir /export
#The dir_name "/export" can be changed it to any other.

  Create directories in the virtual root directory for the filesystems that are to be exported:

root #mkdir /export/distfiles

  Write to "/etc/fstab"

/PATH/TO/distfiles    /export/distfiles    none    bind     

<D> Exports

  The filesystems to be made accessible for clients are specified in /etc/exports. This file consists of the directories to be exported, the clients allowed to access those directories, and a list options for each client:

/export          10.1.0.0/(sync,rw,insecure,no_subtree_check,crossmnt,fsid=root)
/export/distfiles *(sync,ro,insecure,no_subtree_check)

  The following table briefly describes the client options used in the configuration above:

 insecure    The server will require that client requests originate on unprivileged ports (those above ). This option is required when mounting exported directories from OS X. The default is to use privileged ports.
rw The client will have read and write access to the exported directory. The default is to allow read-only access.
sync The server must wait until filesystem changes are committed to storage before responding to further client requests. This is the default.
no_subtree_check The server will not verify the requests from clients(wether it's in the appropriate filesystem or has the correct permissions). This is the default in NFSv4.
crossmnt The server will reveal filesystems that are mounted under the virtual root directory that would otherwise be hidden when a client mounts the virtual root directory.
fsid=root This option is required to uniquely identify the virtual root directory.

  If changes are made to /etc/exports after the NFS server has started, execute the following command:

root #exportfs -rv
OR
root #/etc/init.d/nfs reload
OR
root #systemctl reload nfs.service

<E> Daemon

  The NFS daemon is configured via /etc/conf.d/nfs:

# /etc/conf.d/nfs
# Options to pass to rpc.nfsd
OPTS_RPC_NFSD="8 -N 2 -V 3 -V 4 -p 8888"

  The option 8 is the number of NFS server threads to start.The option -N 2 disables NFS version 2, while options -V 3 and -V 4 enable NFS versions 3 and 4, The option -p 8888 change listening port from the default 2049 to 8888.

<F> Client Service

  To be able to mount exported directories, start the NFS client:

root # service rpcbind start
OR
root # systemctl start rpcbind

<G> Mount on Client

root # mount [-t nfs] 113.114.115.116:/ /mnt    #"-t nfs" argument is not necessary

<H>Troubeshooting

  The system may become unresponsive during shutdown when the NFS client attempts to unmount exported directories after udev has stopped. To prevent this, a local.d script(Gentoo) can be used to forcibly unmount the exported directories during shutdown:

#write in "/etc/local.d/NFS_umount.stop"
/bin/umount -a -f -t nfs

  Remember to add "x" permission:

chmod +x NFS_umount.stop

  Verify which NFS daemons are running:

Gentoo > rpcinfo -p
program vers proto port service
tcp portmapper
udp portmapper
udp status
tcp status
udp mountd
tcp mountd
tcp nfs
tcp nfs
udp nfs
udp nfs
udp nlockmgr

  List the exported directories from the NFS server:

Gentoo > exportfs -v
/export 10.1.7.0/(rw,wdelay,crossmnt,insecure,root_squash,no_subtree_check,fsid=,sec=sys,rw,insecure,root_squash,no_all_squash)

  List the established connections:

Gentoo > ss -tuanp | grep
udp UNCONN *: *:*
udp UNCONN ::: :::*
tcp LISTEN *: *:*
tcp LISTEN ::: :::*

专题:NFSv4 file server的更多相关文章

  1. How to setup vsftpd FTP file Server on Redhat 7 Linux

    Forward from: https://linuxconfig.org/how-to-setup-vsftpd-ftp-file-server-on-redhat-7-linux How to s ...

  2. java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file Server/Request

    Linux服务器上,将本地编译好的文件上传后,Tomcat启动时报错: Exception in thread "Thread-2" java.lang.ClassFormatEr ...

  3. Creating a simple static file server with Rewrite--reference

    Today, I’d like to take a quick moment to demonstrate how to make a simple file server using Rewrite ...

  4. Http File Server小工具

    一般情况下,在做一些测试(比如下载服务)的时候需要提供一个http文件下载服务. 下面这个轻量级的工具HFS可以在本地提供http服务: 官网地址传送门:Http File Server

  5. deno学习四 docker 运行官方的一个http file server

    github 上已经有人搞了一个deno 的docker 镜像,是基于源码编译的,挺好的 所以结合官方的http server demo 使用docker 运行 环境准备 docker-compose ...

  6. [.NET] 使用HttpClient操作HFS (HTTP File Server)

    前言 本篇文章介绍如何使用HttpClient操作HFS (HTTP File Server),为自己留个纪录也希望能帮助到有需要的开发人员.关于HTTP File Server的介绍.安装.设定,可 ...

  7. HFS ~ Http File Server

    HFS ~ Http File Server官网:https://www.rejetto.com/hfs/ 官方下载地址:https://www.rejetto.com/hfs/hfs.exe

  8. flash as3 socket安全服务网关(socket policy file server)

    关键字: SecurityErrorEvent socket as3 flash有着自己的一套安全处理模式,在socket方面,我这样的菜鸟无法理解他的好处:一句话,不怀好意的人如果想用flash写一 ...

  9. GPO - File Server Management

    Creating disk space usage quotas: File Screening Generate Storage Report, including file edit audit. ...

随机推荐

  1. windows10下Mysql5.7安装指南

    背景 值此国庆70周年之际,为了发扬广大国内软件开发行业,我决定使用MySQL5.7. 呸!实际情况是公司的项目用的是Mysql5.7,但是正式服务器在国外,而且测试服务器也是在国外,关键问题是我这个 ...

  2. phhstrom 快捷键

    TODO(表示待办事件)注释 快捷键 Alt+6 Alt+6 可以查看添加了//TODO注释的代码片段 一般我们在开发过程中由于时间或者各方面的时间来不及完成的代码,往往会先将逻辑写出来,实现留待以后 ...

  3. python学习笔记:使用freeze命令迁移模块

    使用freeze 给所有模块搬家 导出安装模块的文档pip freeze > my_freeze.txt 或者指定地址pip freeze > e:\my_freeze.txt 在另一个环 ...

  4. 【外】001-python3之zip函数

    zip函数语法格式zip(可迭代对象1, 可迭代对象2, ... ,可迭代对象n) 函数接收任意个可迭代对象作为参数, 将所有对象中对应位置上的元素分别打包在一起组成一个tuple, 并将所有的tup ...

  5. python获取网页源代码

    最简单的网页取源(不用模拟浏览器的情况) import requests def getHTML(url): try: r = requests.get(url,timeout=30) r.raise ...

  6. vue provide/inject 父组件如何给孙子组件传值

    一般情况下我们父子组件之间的传值用的是props,这个就不多说了,但是如果想让父组件给子组件的组件传值怎么办呢,如果还用props的话肯能会比较复杂,这里我们就可以用到 provide 和 injec ...

  7. JS对象 window对象 屏幕可用高和宽度 1. screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如任务栏。 2. screen.availHeight 属

    屏幕可用高和宽度 1. screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如任务栏. 2. screen.availHeight 属性返回访问者屏幕的高度,以像素 ...

  8. Codeforces Round #552:G. Minimum Possible LCM

    官方题解是时间复杂度为O(nd)的.这里给出一个简单实现但是时间复杂度为O(NlogN) (N=1e7) 因为 a*b/gcd(a,b)=lcm(a,b) 所以我们可以枚举每一个因子,然后找到存在这个 ...

  9. PHP-移除元素

    给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度. 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成 ...

  10. Galaxy

    Galaxy 在一维坐标轴上给出n个点,第i个点坐标为\(x_i\),现在你可以任意移动k个点的,最小化它们的方差,\(n\leq 50000\). 解 感觉以前写的太乱了,补一篇可以供快速阅读的题解 ...