linux中nfs、iscsi的共享方式、用autofs自动挂载的方法

#####################nfs专用于linux的传送
server:

[root@server ~]# yum install nfs-utils                   ###下载nfs
[root@server ~]# systemctl stop smb.service               ###关闭samba因为会冲突
[root@server ~]# systemctl disable smb.service
[root@server /]# systemctl start nfs-server              ##开启nfs
[root@server /]# systemctl enable nfs-server
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'
[root@server /]# systemctl stop firewalld
[root@server /]# systemctl start firewalld
[root@server /]# firewall-cmd --permanent --add-service=nfs                    ##防火墙加nfs
success
[root@server /]# firewall-cmd --permanent --add-service=rpc-bind               ##防火墙加rpc-bind
success
[root@server /]# firewall-cmd --permanent --add-service=mountd                  ##防火墙加mountd
success
[root@server /]# firewall-cmd --reload                                          ##重新加载
success
[root@server /]# vim /etc/exports                                               ##共享什么文件
westos_nfs           *(sync)[root@server /]# exportfs -rv                                                 ##刷新
exporting *:/westos_nfs
[root@server /]# touch /westos_nfs/file{1..9}


client:

[root@desktop ~]# showmount -e 172.25.254.200					##发现共享文件
Export list for 172.25.254.200:
/westos_nfs *
[root@desktop ~]# mount 172.25.254.200:/westos_nfs /mnt[root@desktop mnt]# yum install autofs -y                                    ##下载自动挂载
[root@desktop mnt]# systemctl start autofs[root@desktop mnt]# cd /net
[root@desktop net]# ls
[root@desktop net]# cd 172.25.254.200
[root@desktop 172.25.254.200]# ls
westos_nfs
[root@desktop 172.25.254.200]# df
文件系统                      1K-块    已用    可用 已用% 挂载点
/dev/vda1                  10473900 3216724 7257176   31% /
devtmpfs                     469332       0  469332    0% /dev
tmpfs                        484920      80  484840    1% /dev/shm
tmpfs                        484920   12764  472156    3% /run
tmpfs                        484920       0  484920    0% /sys/fs/cgroup
/dev/mapper/vg0-vo           483670    2339  451840    1% /home
172.25.254.200:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值