Autofs 1(① autofs, ② 실습1)
* 강사님 정리 노트 :
* autofs
# man nfs
0> 개념
- 자동 마운트의 작동을 제어하는 서비스(daemon)
- 자동으로 사용시 파일 시스템을 마운트하고 일정시간이 지나 사용하지 않으면 저절로 언마운트 함
autofs 패키지 설치 유무를 확인!
패키지명은 autofs로 시작함
1> /etc/autofs.conf
(참고로 CentOS 6.5 이후부터는 /etc/autofs.conf 파일로 바뀜.
그전에는 /etc/sysconfig/autofs 파일이었음)
15줄 : 일정시간동안 아무런 작업을 하지 않으면 저절로 언마운트되는 시간이 지정
45줄: 자동으로 생성되는 디렉터리 출력 여부 (기본값 no를 yes로 바꿔주어야함=> ls, cd 가능하게하려면..,)
=> etc/auto.master
2> /etc/auto.master
- 자동으로 생성될 디렉터리와 관련된 설정파일이 저장되어 있는 파일
=> /misc 여기 하위가 client가 autofs mount 할 경로?
=> autofs를 쓸 때 자동마운트 할 경로 (mount pt.?)
7줄 : 자동으로 생성되는 디렉터리 경로와 해당 관련 설정파일이 지정 되어있음
=> /etc/auto.misc
3> /etc/auto.misc
- client의 마운트 포인트명과 접속할 Server-IP와 Server의 공유할 디렉터리를 설정하는 파일
설정방법
16 client의 mount-point -option Server-IP:Server의 share_dir
=> 16 test_nfs_c1 -rw,intr 192.168.46.90:/test_nfs_s1
option
ro → 읽기전용 파일 시스템
rw → 읽고쓰기 파일 시스템
soft → nfs server 요청에 실패하면 returns 설정에 횟수 만큼 재 요청을 시도함
hard → nfs server 요청에 실패하면 무한정 재시도(기본값)
intr(interrupt) → 정지 프로세스를 죽이기 위함
[server]
① 파티션 설정
② 포맷 /dev/sdb1
③ nfs 패키지 설치
④ /etc/exports 설정
⑤ nfs.service 재시작, exportfs -ra
⑥ mount
⑦ automount(재부팅 하면 날라가니까 해줌!) : /etc/exports 쓰기
[client]
① nfs mount (nfs service가 켜져 있어야..,)
=> client도 automount 하고 싶다!
① /etc/fstab이 있다?
② autofs system => 저절로 mount..,
안 쓰면 또 unmount..,
[root@junga /]# rpm -qa | grep autofs
[root@junga /]#
[root@junga /]# yum install autofs*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.nara.wide.ad.jp
* extras: ftp.iij.ad.jp
* updates: mirror.0x.sg
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-70.el7_4.1 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-70.el7_4.1.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.2.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
autofs x86_64 1:5.0.7-70.el7_4.1 updates 809 k
Installing for dependencies:
hesiod x86_64 3.2.1-3.el7 base 30 k
Transaction Summary
============================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 839 k
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): hesiod-3.2.1-3.el7.x86_64.rpm | 30 kB 00:00:00
(2/2): autofs-5.0.7-70.el7_4.1.x86_64.rpm | 809 kB 00:00:02
--------------------------------------------------------------------------------------------
Total 303 kB/s | 839 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : hesiod-3.2.1-3.el7.x86_64 1/2
Installing : 1:autofs-5.0.7-70.el7_4.1.x86_64 2/2
Verifying : 1:autofs-5.0.7-70.el7_4.1.x86_64 1/2
Verifying : hesiod-3.2.1-3.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-70.el7_4.1
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[root@junga /]# vi /etc/autofs.conf
[root@junga /]#
[root@junga /]# ls -l /etc/autofs.conf
-rw-r--r-- 1 root root 14393 1월 26 13:18 /etc/autofs.conf
[root@junga /]#
[root@junga /]# ls -l /etc/auto.master
-rw-r--r-- 1 root root 795 12월 1 04:17 /etc/auto.master
[root@junga /]#
[root@junga /]# vi /etc/auto.master
[root@junga /]#
[root@junga /]# vi /etc/auto.misc
16 test_nfs_c1 -rw,intr 192.168.46.90:/test_nfs_s1
[root@junga /]#
[root@junga /]# tail -1 /etc/auto.misc
test_nfs_c1 -rw,intr 192.168.46.90:/test_nfs_s1
[root@junga /]#
[root@junga /]# systemctl is-active nfs.service
unknown
[root@junga /]#
[root@junga /]# systemctl is-active autofs.service
unknown
[root@junga /]# systemctl restart nfs.service
[root@junga /]#
[root@junga /]# systemctl restart autofs.service
[root@junga /]# systemctl -l status autofs.service
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; vendor preset: disabled)
Active: active (running) since 금 2018-01-26 14:02:04 KST; 1min 25s ago
Process: 4379 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
Main PID: 4381 (automount)
CGroup: /system.slice/autofs.service
└─4381 /usr/sbin/automount --pid-file /run/autofs.pid
1월 26 14:01:54 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:01:54 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:01:56 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:01:58 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:02:00 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:02:02 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:02:04 junga.kgitbank automount[4381]: problem reading master map, maximum wait exceeded
1월 26 14:02:04 junga.kgitbank automount[4381]: /usr/sbin/automount: warning: could not read at least one map source after waiting, continuing ...
1월 26 14:02:04 junga.kgitbank automount[4381]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:02:04 junga.kgitbank systemd[1]: Started Automounts filesystems on demand.
[root@junga /]# ls -l /misc
합계 0
dr-xr-xr-x 2 root root 0 1월 26 14:02 cd
dr-xr-xr-x 2 root root 0 1월 26 14:02 test_nfs_c1 // autofs 재 시작 후 생성
[root@junga /]#
[root@junga /]#
// 확인
[client]
[root@junga /]# ls -l /misc/test_nfs_c1
합계 0
[root@junga /]#
[root@junga /]# touch /misc/test_nfs_c1/testfile2
[root@junga /]#
[root@junga /]# ls -l /misc/test_nfs_c1
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:12 testfile2
[server]
[root@junga ~]# ls -l /test_nfs_s1
합계 0
[root@junga ~]# ls -l /test_nfs_s1
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:12 testfile2
// reboot 후?
==============================
<실습 1>
autofs 실습
- client에서 어제 환경설정을 이어서..
HDD : 1GB, SCSI
Partition : 100, 200, 300(이걸 사용), 400
nfs server
/etc/exports -> 호스트 방식(우리가 연습했던 옵션 그대로)
auto mount
nfs client
autofs service를 사용
nfs client 마운트포인트에서 파일이나 디렉터리 생성 후 nfs server에서도 공유되는지 확인(반드시 재부팅 후 확인)
[server]
① /dev/sdb3 format, automount(/etc/fstab + mount)
② autofs 설치
③ 설정파일 : /etc/autofs.conf (line. 45)
autofs mount pt. : /etc/auto.master (line. 7) 확인
④ autofs 재시작 및 /misc 폴더 생성 확인
⑤ 확인 및 reboot (안되면 reset!)
// ①
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 13G 7.4G 5.6G 57% /
devtmpfs 474M 0 474M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.1M 481M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sdb1 97M 5.2M 92M 6% /auto/sharedir
/dev/sda5 197M 16M 181M 9% /home
/dev/sda1 997M 194M 803M 20% /boot
/dev/sda3 2.0G 453M 1.6G 23% /var
tmpfs 98M 4.0K 98M 1% /run/user/42
tmpfs 98M 24K 98M 1% /run/user/0
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.46.85:/auto/sharedir 97M 5.3M 92M 6% /test_nfs_c1
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x80ac2390
Device Boot Start End Blocks Id System
/dev/sdb1 2048 206847 102400 83 Linux
/dev/sdb2 206848 616447 204800 83 Linux
/dev/sdb3 616448 1230847 307200 83 Linux
/dev/sdb4 1230848 2097151 433152 83 Linux
[root@localhost ~]#
[root@localhost ~]# mkfs.xfs /dev/sdb3
mkfs.xfs: /dev/sdb3 appears to contain an existing filesystem (xfs).
mkfs.xfs: Use the -f option to force overwrite.
[root@localhost ~]#
[root@localhost ~]# blkid /dev/sdb3
/dev/sdb3: UUID="ddf9e8e5-e124-4cf6-bf0f-49777b22637d" TYPE="xfs"
[root@localhost ~]#
[root@localhost ~]# vi /etc/exports
[root@localhost ~]#
[root@localhost ~]# vi /etc/fstab
[root@localhost ~]#
[root@localhost ~]# df -h | tail -2
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.46.85:/auto/sharedir 97M 5.3M 92M 6% /test_nfs_c1
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 13G 7.4G 5.6G 57% /
devtmpfs 474M 0 474M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.1M 481M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sdb1 97M 5.2M 92M 6% /auto/sharedir
/dev/sda5 197M 16M 181M 9% /home
/dev/sda1 997M 194M 803M 20% /boot
/dev/sda3 2.0G 453M 1.6G 23% /var
tmpfs 98M 4.0K 98M 1% /run/user/42
tmpfs 98M 24K 98M 1% /run/user/0
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.46.85:/auto/sharedir 97M 5.3M 92M 6% /test_nfs_c1
[root@localhost ~]#
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Jan 11 13:46:02 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=bbfd7ee6-e6db-40ef-8ed1-03b0efff5577 / xfs defaults 0 0
UUID=4eaedded-01f7-4013-a328-364dfe587223 /boot xfs defaults 0 0
UUID=bfcdb9c5-05c7-49ba-b530-8d4aedd39841 /home xfs defaults 0 0
UUID=d2a7fb6a-fe3b-4022-93b0-8e4f6044cfb8 /var xfs defaults 0 0
UUID=3e93d164-8196-471f-90a9-0f1937711e92 swap swap defaults 0 0
/dev/sdb1 /auto/sharedir xfs defaults 0 0
/dev/sdb3 /server_auto xfs defaults 0 0
[root@localhost ~]#
[root@localhost ~]# mkdir /server_auto
[root@localhost ~]#
[root@localhost ~]# mount /dev/sdb3 /server_auto
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 13G 7.4G 5.6G 57% /
devtmpfs 474M 0 474M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.1M 481M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sdb1 97M 5.2M 92M 6% /auto/sharedir
/dev/sda5 197M 16M 181M 9% /home
/dev/sda1 997M 194M 803M 20% /boot
/dev/sda3 2.0G 453M 1.6G 23% /var
tmpfs 98M 4.0K 98M 1% /run/user/42
tmpfs 98M 24K 98M 1% /run/user/0
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.46.85:/auto/sharedir 97M 5.3M 92M 6% /test_nfs_c1
/dev/sdb3 297M 16M 282M 6% /server_auto
// ② autofs 설치
[root@localhost ~]# rpm -qa | grep autofs
[root@localhost ~]#
[root@localhost ~]# yum install autofs*
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 6.0 MB 00:00:00
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-70.el7_4.1 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-70.el7_4.1.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.2.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
autofs x86_64 1:5.0.7-70.el7_4.1 updates 809 k
Installing for dependencies:
hesiod x86_64 3.2.1-3.el7 base 30 k
Transaction Summary
============================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 839 k
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): hesiod-3.2.1-3.el7.x86_64.rpm | 30 kB 00:00:00
(2/2): autofs-5.0.7-70.el7_4.1.x86_64.rpm | 809 kB 00:00:01
--------------------------------------------------------------------------------------------
Total 598 kB/s | 839 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : hesiod-3.2.1-3.el7.x86_64 1/2
Installing : 1:autofs-5.0.7-70.el7_4.1.x86_64 2/2
Verifying : 1:autofs-5.0.7-70.el7_4.1.x86_64 1/2
Verifying : hesiod-3.2.1-3.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-70.el7_4.1
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[root@localhost ~]# rpm -qa | grep autofs
autofs-5.0.7-70.el7_4.1.x86_64
// ③
[root@localhost ~]# ls -l /etc/autofs.conf
-rw-r--r-- 1 root root 14392 12월 1 04:17 /etc/autofs.conf
[root@localhost ~]#
[root@localhost ~]# vi /etc/autofs.conf
45 browse_mode = yes
:wq
7 /misc /etc/auto.misc
// ④
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]#
[root@localhost ~]# systemctl is-active autofs.service
active
[root@localhost ~]#
[root@localhost ~]# systemctl -l status autofs.service
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; vendor preset: disabled)
Active: active (running) since 금 2018-01-26 14:31:45 KST; 1min 9s ago
Process: 14645 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
Main PID: 14647 (automount)
CGroup: /system.slice/autofs.service
└─14647 /usr/sbin/automount --pid-file /run/autofs.pid
1월 26 14:31:35 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:35 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:37 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:39 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:41 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:43 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:45 localhost.localdomain automount[14647]: problem reading master map, maximum wait exceeded
1월 26 14:31:45 localhost.localdomain automount[14647]: /usr/sbin/automount: warning: could not read at least one map source after waiting, continuing ...
1월 26 14:31:45 localhost.localdomain automount[14647]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:31:45 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vi /etc/auto.misc
16 test_autofs -rw,intr 192.168.46.85:/server_auto
// ④
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]# systemctl -l status autofs.service
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; vendor preset: disabled)
Active: active (running) since 금 2018-01-26 14:39:19 KST; 16s ago
Process: 14935 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
Main PID: 14937 (automount)
CGroup: /system.slice/autofs.service
└─14937 /usr/sbin/automount --pid-file /run/autofs.pid
1월 26 14:39:09 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:09 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:11 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:13 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:15 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:17 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:19 localhost.localdomain automount[14937]: problem reading master map, maximum wait exceeded
1월 26 14:39:19 localhost.localdomain automount[14937]: /usr/sbin/automount: warning: could not read at least one map source after waiting, continuing ...
1월 26 14:39:19 localhost.localdomain automount[14937]: open_sss_lib:78: lookup(sss): failed to open /usr/lib64/sssd/modules/libsss_autofs.so: /usr/lib64/sssd/modules/libsss_autofs.so: cannot open shared object file: No such file or directory
1월 26 14:39:19 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.
[root@localhost ~]#
[root@localhost ~]# ls -l /misc/
합계 0
dr-xr-xr-x 2 root root 0 1월 26 14:39 cd
dr-xr-xr-x 2 root root 0 1월 26 14:39 test_autofs
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 13G 7.4G 5.6G 57% /
devtmpfs 474M 0 474M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.1M 481M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sdb1 97M 5.2M 92M 6% /auto/sharedir
/dev/sda5 197M 16M 181M 9% /home
/dev/sda1 997M 194M 803M 20% /boot
/dev/sda3 2.0G 456M 1.5G 23% /var
tmpfs 98M 4.0K 98M 1% /run/user/42
tmpfs 98M 24K 98M 1% /run/user/0
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.46.85:/auto/sharedir 97M 5.3M 92M 6% /test_nfs_c1
/dev/sdb3 297M 16M 282M 6% /server_auto
[root@localhost ~]#
// ⑤
[root@localhost ~]# cat /etc/auto.misc
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
# the following entries are samples to pique your imagination
#linux -ro,soft,intr ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd
test_autofs -rw,intr 192.168.46.85:/server_auto
[root@localhost ~]#
[root@localhost ~]# ls -l /misc/test_autofs/ /server_auto/
/misc/test_autofs/:
합계 0
/server_auto/:
합계 0
[root@localhost ~]#
[root@localhost ~]# touch /misc/test_autofs/testfile1
[root@localhost ~]#
[root@localhost ~]# ls -l /misc/test_autofs/ /server_auto
/misc/test_autofs/:
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
/server_auto:
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
[root@localhost ~]#
==============================
// 실습_ 쌤 풀이
[server]
① format
② nfs service 관련 : /etc/exports 에서 공유 디렉터리 설정 ★
mount?
(장치 2개니까 공유디렉터리도 2개 생성해야..,)
# vi /etc/exports
/server_auto 192.168.46.85(rw,no_root_squash,sync)
:wq
# exportfs -ra
# mount /dev/sdb3 /sever_auto
③ automount
# vi /etc/fstab
/dev/sdb3 /server_auto xfs defaults 0 0
---------------------------------------------
[client]
① autofs 설치
# rpm -qa | grep autofs
# yum install autofs*
y
② autofs 환경설정파일 : /etc/autofs.conf
mount 관련 파일 : /etc/auto.misc
# vi /etc/autofs.conf
45 browse_mode = yes
# vi /etc/auto.misc
16 test_autofs -rw,intr 192.168.46.85:/server_auto // client가 사용할 mount pt. 이름
// ↑ client사용 영역 => client_autofs 라고 바꿔야징..,
:wq
③ autofs 재 시작
# systemctl restart autofs.service
# ls -l /misc
합계 0
dr-xr-xr-x 2 root root 0 1월 26 15:06 cd
dr-xr-xr-x 2 root root 0 1월 26 15:06 test_autofs
# ls -l /misc/test_autofs/ /server_auto/
/misc/test_autofs/:
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
/server_auto/:
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
-----------------------------------------------
// 확인
[server]
[root@localhost ~]# systemctl restart nfs.service
[root@localhost ~]#
[root@localhost ~]# ls -l /server_auto/
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
-rw-r--r-- 1 root root 0 1월 26 15:09 testfile2
[root@localhost ~]#
[root@localhost ~]#
[client]
[root@localhost ~]# systemctl restart autofs.service
[root@localhost ~]#
[root@localhost ~]# ls -l /misc/
합계 0
dr-xr-xr-x 2 root root 0 1월 26 15:15 cd
dr-xr-xr-x 2 root root 0 1월 26 15:15 test_autofs
[root@localhost ~]#
[root@localhost ~]# ls -l /misc/test_autofs/
합계 0
-rw-r--r-- 1 root root 0 1월 26 14:44 testfile1
-rw-r--r-- 1 root root 0 1월 26 15:09 testfile2
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 13G 7.4G 5.6G 57% /
devtmpfs 474M 0 474M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.1M 481M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sdb1 97M 5.2M 92M 6% /auto/sharedir
/dev/sdb3 297M 16M 282M 6% /server_auto
/dev/sda5 197M 16M 181M 9% /home
/dev/sda3 2.0G 456M 1.5G 23% /var
/dev/sda1 997M 194M 803M 20% /boot
tmpfs 98M 4.0K 98M 1% /run/user/42
tmpfs 98M 16K 98M 1% /run/user/0
/dev/sr0 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
[root@localhost ~]#
=> 다음 실습은,
① server restart 없이 되야 하고,
② 진짜로 서버, 클라이언트 2개 pc 이용!
==============================
* clinet, server snapshot 형태
// 요약
// autofs 설치
# rpm -qa | grep autofs
# yum install autofs*
Is this ok [y/d/N]: y
// /misc 하위 파일 설정
// autofs 재시작
'BigData_Off1 > 리눅스2' 카테고리의 다른 글
2018.01.30 ~ 02.02-14-17일차 DNS(개념, 실습1-4) (0) | 2018.01.30 |
---|---|
Autofs 2(① autofs 2nd, ② 실습1) (0) | 2018.01.29 |
File Service 3(③auto mount ④NFS) (0) | 2018.01.24 |
File Service 2(①ftpSvc1(vsftpd) ②응급복구 ③auto mount) (0) | 2018.01.23 |
File Service 1(①ftpSvc1(vsftpd)) (0) | 2018.01.22 |