当前位置:网站首页>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,实现统一配置。
边栏推荐
- Pytest multi process / multi thread execution test case
- Go 语言入门很简单:Go 实现凯撒密码
- 函数计算异步任务能力介绍 - 任务触发去重
- (指针)编写函数void fun(int x,int *pp,int *n)
- 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
- vue多级路由嵌套怎么动态缓存组件
- 软件测试是干什么的 发现缺陷错误,提高软件的质量
- How was my life in 2021
- postgresql 用户不能自己创建表格配置
- 疫情来袭--远程办公之思考|社区征文
猜你喜欢
深度优先搜索简要讲解(附带基础题)
02 ls 命令的具体实现
Distributed system: what, why, how
量子力学习题
Brief explanation of depth first search (with basic questions)
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
[Logitech] m720
ctf-pikachu-CSRF
如何有效远程办公之我见 | 社区征文
Introduction to asynchronous task capability of function calculation - task trigger de duplication
随机推荐
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
思考的小记录
Common methods of threads
Support the first triggered go ticker
毕业三年,远程半年 | 社区征文
【微服务|openfeign】使用openfeign远程调用文件上传接口
Flink学习8:数据的一致性
北漂程序员,月薪20K,一年攒15W,正常吗?
Katalon使用script实现查询List大小
10 reasons for not choosing to use free virtual hosts
Evolution of MySQL database architecture
Storage of MySQL database
干货!基于GAN的稀有样本生成
2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.
leetcode刷题:二叉树05(翻转二叉树)
[Huawei cloud IOT] reading notes, "Internet of things: core technology and security of the Internet of things", Chapter 3 (I)
Introduction to asynchronous task capability of function calculation - task trigger de duplication
Illustrated network: what is the hot backup router protocol HSRP?
还原窗口位置的微妙之处
Go 语言入门很简单:Go 实现凯撒密码