安装nfsclient

#ubantu、uos、kylin等 U系
sudo apt-get update
sudo apt-get install nfs-common

#centOS等 R系
sudo yum  install nfs-utils

1.查看nfs server上共享的目录:showmount -e nfs服务ip

例:如下,有4个目录可供挂载。

[root@localhost common]# showmount -e 192.168.1.100
Export list for 192.168.1.100:
/nfs/test/files			  *
/nfs/test/common          *
/nfs/test/tools       	  *
/nfs/test/daily           *
[root@localhost common]#

2.挂载nfs目录到本地

例如:把nfs服务器上的“/nfs/test/common”挂载到本地 “/mnt”下(本地目录可自定义:如/home/uos/common,但需要先创建奥)

#1
sudo mount -t nfs 192.168.1.100:/nfs/test/common /mnt

#2
#本地目录需要先创建奥
#sudo mount -t nfs 192.168.1.100:/nfs/test/common /home/uos/common

[root@localhost ~]# sudo mount -t nfs 192.168.1.100:/nfs/test/common /mnt
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ll
total 328
drwxr-xr-x 2 nobody nobody  4096 Sep 29  2021 用户手册
-rwxr-xr-x 1 nobody nobody   268 Dec 17 09:17 check_uos_zwww.sh
-rw-r--r-- 1 nobody nobody   506 Dec 17 09:16 mkdir2.py
-rw-r--r-- 1 nobody nobody  1073 Dec 17 09:17 mkdir.py
drwxr-xr-x 8 nobody nobody  4096 Jan 29 17:25 shell
-rwxr-xr-x 1 nobody nobody    82 Sep 22  2021 test.sh
drwxr-xr-x 8 nobody nobody  4096 Mar 17 15:58 临时存储_gc
[root@localhost mnt]#

如果带图形化显示,则可在此处看到被挂载目录(如,UOS系统):

 3.卸载

       umount 本地挂载目录

umount /mnt

        注意,不能在本地挂载目录内卸载,否则卸不掉

        

GitHub 加速计划 / li / linux-dash
11
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐