当前位置:网站首页>RHCSA 08 - automount配置
RHCSA 08 - automount配置
2022-07-04 03:51:00 【王万林 Ben】
前言
目录按需挂载,空闲时自动卸载,可以采用automount技术。尤其是在大型HPC环境,成千上万的用户家目录,使用automount降低seek time,提高dentry缓存命中率,可大大节省内存资源。
环境
RHEL 8
实践
安装nfs-utils,它提供nfs server,
[[email protected] ~]# dnf install -y nfs-utils
Rocky Linux 8 - AppStream 14 kB/s | 4.8 kB 00:00
Rocky Linux 8 - AppStream 20 MB/s | 8.8 MB 00:00
Rocky Linux 8 - BaseOS 17 kB/s | 4.3 kB 00:00
Rocky Linux 8 - BaseOS 8.7 MB/s | 3.6 MB 00:00
Rocky Linux 8 - Extras 14 kB/s | 3.5 kB 00:00
Rocky Linux 8 - Extras 39 kB/s | 11 kB 00:00
Dependencies resolved.
====================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================
Installing:
nfs-utils x86_64 1:2.3.3-51.el8 baseos 503 k
Installing dependencies:
gssproxy x86_64 0.8.0-20.el8 baseos 118 k
keyutils x86_64 1.5.10-9.el8 baseos 65 k
libverto-libevent x86_64 0.3.0-5.el8 baseos 15 k
python3-pyyaml x86_64 3.12-12.el8 baseos 192 k
quota x86_64 1:4.04-14.el8 baseos 213 k
quota-nls noarch 1:4.04-14.el8 baseos 94 k
rpcbind x86_64 1.2.5-8.el8 baseos 69 k
Transaction Summary
====================================================================================================================
Install 8 Packages
Total download size: 1.2 M
Installed size: 3.8 M
Downloading Packages:
(1/8): libverto-libevent-0.3.0-5.el8.x86_64.rpm 333 kB/s | 15 kB 00:00
(2/8): gssproxy-0.8.0-20.el8.x86_64.rpm 2.3 MB/s | 118 kB 00:00
(3/8): keyutils-1.5.10-9.el8.x86_64.rpm 1.2 MB/s | 65 kB 00:00
(4/8): python3-pyyaml-3.12-12.el8.x86_64.rpm 16 MB/s | 192 kB 00:00
(5/8): nfs-utils-2.3.3-51.el8.x86_64.rpm 23 MB/s | 503 kB 00:00
(6/8): quota-nls-4.04-14.el8.noarch.rpm 10 MB/s | 94 kB 00:00
(7/8): rpcbind-1.2.5-8.el8.x86_64.rpm 11 MB/s | 69 kB 00:00
(8/8): quota-4.04-14.el8.x86_64.rpm 10 MB/s | 213 kB 00:00
--------------------------------------------------------------------------------------------------------------------
Total 4.5 MB/s | 1.2 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: rpcbind-1.2.5-8.el8.x86_64 1/8
Installing : rpcbind-1.2.5-8.el8.x86_64 1/8
Running scriptlet: rpcbind-1.2.5-8.el8.x86_64 1/8
Installing : quota-nls-1:4.04-14.el8.noarch 2/8
Installing : quota-1:4.04-14.el8.x86_64 3/8
Installing : python3-pyyaml-3.12-12.el8.x86_64 4/8
Installing : libverto-libevent-0.3.0-5.el8.x86_64 5/8
Installing : gssproxy-0.8.0-20.el8.x86_64 6/8
Running scriptlet: gssproxy-0.8.0-20.el8.x86_64 6/8
Installing : keyutils-1.5.10-9.el8.x86_64 7/8
Running scriptlet: nfs-utils-1:2.3.3-51.el8.x86_64 8/8
Installing : nfs-utils-1:2.3.3-51.el8.x86_64 8/8
Running scriptlet: nfs-utils-1:2.3.3-51.el8.x86_64 8/8
Verifying : gssproxy-0.8.0-20.el8.x86_64 1/8
Verifying : keyutils-1.5.10-9.el8.x86_64 2/8
Verifying : libverto-libevent-0.3.0-5.el8.x86_64 3/8
Verifying : nfs-utils-1:2.3.3-51.el8.x86_64 4/8
Verifying : python3-pyyaml-3.12-12.el8.x86_64 5/8
Verifying : quota-1:4.04-14.el8.x86_64 6/8
Verifying : quota-nls-1:4.04-14.el8.noarch 7/8
Verifying : rpcbind-1.2.5-8.el8.x86_64 8/8
Installed:
gssproxy-0.8.0-20.el8.x86_64 keyutils-1.5.10-9.el8.x86_64 libverto-libevent-0.3.0-5.el8.x86_64
nfs-utils-1:2.3.3-51.el8.x86_64 python3-pyyaml-3.12-12.el8.x86_64 quota-1:4.04-14.el8.x86_64
quota-nls-1:4.04-14.el8.noarch rpcbind-1.2.5-8.el8.x86_64
Complete!
创建目录并导出,启动nfs server,
[[email protected] ~]# mkdir -p /users/nfs/{lisa,linda,anna}
[[email protected] ~]# echo "/users *(rw,no_root_squash)" > /etc/exports
[[email protected] ~]# systemctl enable --now nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
[[email protected] ~]# showmount -e localhost
Export list for localhost:
/users *
在客户端,安装autofs,
[[email protected] ~]# dnf install -y autofs
Last metadata expiration check: 0:00:19 ago on Sat 02 Jul 2022 07:14:43 AM CEST.
Dependencies resolved.
====================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================
Installing:
autofs x86_64 1:5.1.4-82.el8 baseos 706 k
Transaction Summary
====================================================================================================================
Install 1 Package
Total download size: 706 k
Installed size: 2.8 M
Downloading Packages:
autofs-5.1.4-82.el8.x86_64.rpm 9.6 MB/s | 706 kB 00:00
--------------------------------------------------------------------------------------------------------------------
Total 2.6 MB/s | 706 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : autofs-1:5.1.4-82.el8.x86_64 1/1
Running scriptlet: autofs-1:5.1.4-82.el8.x86_64 1/1
Verifying : autofs-1:5.1.4-82.el8.x86_64 1/1
Installed:
autofs-1:5.1.4-82.el8.x86_64
Complete!
参考/misc配置项,对家目录进行配置,并启动autofs服务,
[[email protected] ~]# grep '^/misc' /etc/auto.master
/misc /etc/auto.misc
[[email protected] ~]# echo "/home/nfs /etc/auto.nfs" >> /etc/auto.master
[[email protected] ~]# grep -i linux /etc/auto.misc
#linux -ro,soft ftp.example.org:/pub/linux
[[email protected] ~]# echo "* -rw localhost:/users/nfs/&" > /etc/auto.nfs
[[email protected] ~]# systemctl enable --now autofs
Created symlink /etc/systemd/system/multi-user.target.wants/autofs.service → /usr/lib/systemd/system/autofs.service.
检查/home/nfs目录,没有任何文件(夹),
[[email protected] ~]# ls -al /home/nfs
total 0
drwxr-xr-x. 2 root root 0 Jul 2 07:15 .
drwxr-xr-x. 4 root root 31 Jul 2 07:15 ..
触发一下其中一个子目录,可以看到挂载上了,
[[email protected] ~]# cd /home/nfs/linda
[[email protected] linda]# pwd
/home/nfs/linda
[[email protected] linda]# mount | tail -5
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
/etc/auto.misc on /misc type autofs (rw,relatime,fd=5,pgrp=10818,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=41624)
-hosts on /net type autofs (rw,relatime,fd=11,pgrp=10818,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=41636)
/etc/auto.nfs on /home/nfs type autofs (rw,relatime,fd=17,pgrp=10818,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=41640)
/dev/mapper/rl-root on /home/nfs/linda type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
后记
在大型HPC环境,一般在LDAP里配置好不同location的AUTOMOUNT,实现统一配置。
边栏推荐
- ctf-pikachu-CSRF
- 深度优先搜索简要讲解(附带基础题)
- Flink学习6:编程模型
- [paddleseg source code reading] paddleseg calculation dice
- [book club issue 13] packaging format of video files
- I Build a simple microservice project
- Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure
- 如何远程办公更有效率 | 社区征文
- The difference between bagging and boosting in machine learning
- 1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
猜你喜欢
Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
Katalon中控件的参数化
Unity 绘制弹球和台球的运动轨迹
Rhcsa-- day one
Confession code collection, who says program apes don't understand romance
There is a problem that the package cannot be parsed in the like project
LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDebug”(main.obj 中)
Select sorting and bubble sorting template
Flink learning 8: data consistency
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability
随机推荐
vim映射命令
idea修改主体颜色
Perf simple process for multithreaded profile
北漂程序员,月薪20K,一年攒15W,正常吗?
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
线程常用的方法
如何有效远程办公之我见 | 社区征文
leetcode刷题:二叉树05(翻转二叉树)
思考的小记录
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Three years of graduation, half a year of distance | community essay solicitation
Common methods of threads
02 specific implementation of LS command
RHCSA 06 - suid, sgid, sticky bit(待补充)
还原窗口位置的微妙之处
Katalon framework tests web (XXI) to obtain element attribute assertions
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Go 语言入门很简单:Go 实现凯撒密码
Small record of thinking
I was tortured by my colleague's null pointer for a long time, and finally learned how to deal with null pointer