#############################################################################################centos
步骤服务器 |
操做命令spa |
安装软件包nfsrest |
#yum -y install nfs-utils rpcbindserver |
|
|
NFS的配置文件为/etc/exports,文件内容默认为空(无任何共享)。在exports文件中设置;blog
例:/mnt/share *(rw,sync,no_root_squash,no_subtree_check)ci
步骤rpc |
操做命令table |
设置共享目录class |
#mkdir /mnt/share #chmod 755 /mnt/share |
将硬盘挂到/mnt/share |
#mount /dev/sdb /mnt/share |
修改NFS配置文件 |
#vi /etc/exports 添加: ###############/etc/exports############### /mnt/share *(rw,sync,no_root_squash,no_subtree_check)
###############/etc/exports################ |
添加到服务器自启动 |
#vi /etc/fstab 添加: ################/etc/fstab##################### /dev/sdb /mnt/sha/etc/fstabre auto defaults 0 0
#############/etc/fstab################# |
步骤 |
操做命令 |
配置生效和服务重启并开机自启动服务 |
#exportfs -r (centos6.X) #service rpcbind start #service nfs start #chkconfig on rpcbind #chkconfig on nfs (Centos7.X) #systemctl restart rpcbind.service #systemctl restart nfs-server.service #systemctl enable rpcbind.service #systemctl enable nfs-server.service (先启动rpc,再启动nfs;) |
步骤 |
操做命令 |
查看 |
#showmount -e |
步骤 |
操做命令 |
安装软件包nfs |
#yum -y install nfs-utils rpcbind |
步骤 |
操做命令 |
查看NFS服务端的共享目录 |
#showmount -e 服务端IP |
步骤 |
操做命令 |
新建目录 |
#mkdir /data01 #chmod 755 /data01 |
挂载 |
#mount -t nfs MASTER_IP:/mnt/share /data01 |
修改配置文件,添加服务开机自动挂载
|
#vi /etc/fstab 添加: #################/etc/fstab####################### MASTER_IP:/mnt/share /mnt/share nfs defaluts 0 0
#################/etc/fstab###################### |
步骤 |
操做命令 |
服务NFS重启并开机自启动服务 |
(centos6.X) #service rpcbind start #service nfs start #chkconfig on rpcbind #chkconfig on nfs (Centos7.X) #systemctl restart rpcbind.service #systemctl restart nfs-server.service #systemctl enable rpcbind.service #systemctl enable nfs-server.service (先启动rpc,再启动nfs;) |