本篇介绍在centos7.9系统中安装autofs自动挂载nfs
集群已经部署完成了nfs服务,其导出的共享目录地址为:192.168.80.187:/home/export/base
,需求是在node17里面当用户登陆时,自动挂载/home/export/base
,用户的home着陆地址为/home/export/base/group/user
首先yum -y install autofs
编辑配置文件vim /etc/auto.master
,最后一行添加:/home/export /etc/auto.home
创建配置文件vim /etc/auto.home
,增加内容:base 192.168.80.187:/home/export/base
启动autofs服务systemctl start autofs && systemctl enable autofs
通过登陆验证,当切换到用户时,自动挂载/home/export/base
[root@node18][~]
$ df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 486M 0 486M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 6.7M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda2 30G 2.1G 28G 8% /
/dev/sda1 497M 124M 373M 25% /boot
192.168.80.186:/opt/hpc 100G 3.0G 97G 3% /opt/hpc
192.168.80.19@tcp:192.168.80.20@tcp:/mylustre 589G 8.3M 559G 1% /online1
tmpfs 100M 0 100M 0% /run/user/0
[root@node18][~]
$ su - liwl
上一次登录:五 11月 25 08:37:31 CST 2022从 192.168.80.1pts/0 上
[liwl@node18][~/online1]
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 486M 0 486M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 6.7M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda2 30G 2.1G 28G 8% /
/dev/sda1 497M 124M 373M 25% /boot
192.168.80.186:/opt/hpc 100G 3.0G 97G 3% /opt/hpc
192.168.80.19@tcp:192.168.80.20@tcp:/mylustre 589G 8.3M 559G 1% /online1
tmpfs 100M 0 100M 0% /run/user/0
192.168.80.187:/home/export/base 100G 33M 100G 1% /home/export/base
[liwl@node18][~]
$ pwd
/home/export/base/sysadm/liwl
标签:496M,192.168,centos7,export,base,nfs,autofs,home,tmpfs
From: https://www.cnblogs.com/liwanliangblog/p/16925312.html