#############################################################################################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;) |