본문 바로가기
공부/리눅스 서버

[linux] NFS 마운트 후 하위 폴더 추가 방법

by kyoung-ho 2021. 12. 10.
반응형

이미 걸려있는 NFS에 폴더를 추가할일이 생겼다.

폴더를 추가해보자.

 

원본 NFS서버

[root@gdcfile01 pds]# ll
total 692611000
drwxr-xr-x    2 crizen web          4096 2021-12-09 16:52 giocapital
drwxr-x--x 2312 crizen web         69632 2021-12-10 08:53 golden
-rw-r--r--    1 root   root 690942019402 2021-10-28 10:38 golden_170220.tgz
-rw-r--r--    1 root   root  18291246750 2021-10-27 18:51 golden_backup.tgz
drwx------    2 crizen web         16384 2016-02-03 14:36 lost+found
drwxr-xr-x    5 root   root         4096 2018-02-02 05:31 rsync_gdcwas03
drwxr-xr-x    5 root   root       126976 2021-12-10 00:01 rsync_mysql_gdcwas03
[root@gdcfile01 pds]# mkdir test
[root@gdcfile01 pds]# ll
total 692611004
drwxr-xr-x    2 crizen web          4096 2021-12-09 16:52 giocapital
drwxr-x--x 2312 crizen web         69632 2021-12-10 08:53 golden
-rw-r--r--    1 root   root 690942019402 2021-10-28 10:38 golden_170220.tgz
-rw-r--r--    1 root   root  18291246750 2021-10-27 18:51 golden_backup.tgz
drwx------    2 crizen web         16384 2016-02-03 14:36 lost+found
drwxr-xr-x    5 root   root         4096 2018-02-02 05:31 rsync_gdcwas03
drwxr-xr-x    5 root   root       126976 2021-12-10 00:01 rsync_mysql_gdcwas03
drwxr-xr-x    2 root   root         4096 2021-12-10 14:04 test  <-- 디렉터리 추가
[root@gdcfile01 pds]# chown crizen:web test
[root@gdcfile01 pds]# ll
total 692611004
drwxr-xr-x    2 crizen web          4096 2021-12-09 16:52 giocapital
drwxr-x--x 2312 crizen web         69632 2021-12-10 08:53 golden
-rw-r--r--    1 root   root 690942019402 2021-10-28 10:38 golden_170220.tgz
-rw-r--r--    1 root   root  18291246750 2021-10-27 18:51 golden_backup.tgz
drwx------    2 crizen web         16384 2016-02-03 14:36 lost+found
drwxr-xr-x    5 root   root         4096 2018-02-02 05:31 rsync_gdcwas03
drwxr-xr-x    5 root   root       126976 2021-12-10 00:01 rsync_mysql_gdcwas03
drwxr-xr-x    2 crizen web          4096 2021-12-10 14:04 test

 

NFS 마운트 되어있는 서버

[root@gdcwas03 pds]# df -hT
Filesystem      Type   Size  Used Avail Use% Mounted on
/dev/sda3       ext4   487G  332G  131G  72% /
tmpfs           tmpfs   45G   15G   31G  33% /dev/shm
/dev/sda1       ext4   190M   71M  110M  40% /boot
/dev/sdb1       ext4   1.8T  692G  1.1T  40% /backup
tmpfs           tmpfs   45G   15G   31G  33% /dev/shm
gdcfile01:/pds/ nfs    9.0T  6.4T  2.2T  76% /pds
[root@gdcwas03 pds]# cd /pds
[root@gdcwas03 pds]# ll
total 76
drwxr-xr-x    2 crizen web  4096 2021-12-09 16:52 giocapital
drwxr-x--x 2312 crizen web 69632 2021-12-10 08:53 golden

 

원본 NFS 서버에서 아무리 폴더를 생성했다 하더라도 마운트 되어있는 서버에 반영이 되질 않는다.

 

원본 NFS서버

[root@gdcfile01 pds]# vi /etc/exports
/pds/golden 192.168.52.78(rw,sync,no_root_squash)
/pds/golden 192.168.52.80(rw,sync,no_root_squash)
/pds/giocapital 192.168.52.80(rw,sync,no_root_squash)
/pds/test 192.168.52.80(rw,sync,no_root_squash)

80서버에 추가한 test디렉터리를 지정.

[root@gdcfile01 pds]# exportfs -r <-- 설정한 exports를 리빌드

 

 

NFS 마운트 되어있는 서버

[root@gdcwas03 /]# mount -t nfs -o remount,rw gdcfile01:/pds/ /pds/
[root@gdcwas03 /]# cd /pds
[root@gdcwas03 pds]# ll
total 80
drwxr-xr-x    2 crizen web  4096 2021-12-09 16:52 giocapital
drwxr-x--x 2312 crizen web 69632 2021-12-10 08:53 golden
drwxr-xr-x    2 crizen web  4096 2021-12-10 14:04 test

추가 완료.

 

** 상위 폴더를 마운트하면 하위폴더가 보여짐, exports 설정에서 절대경로로 지정해두면 지정된 폴더만 보여짐.

반응형

'공부 > 리눅스 서버' 카테고리의 다른 글

[linux] nfs mount error  (0) 2021.12.29
[linux] Errno 256 No more mirrors to try ?  (0) 2021.12.16
[linux] rpm 삭제 및 설치  (0) 2021.12.10
[linux] /var/cache/yum 용량 관리  (2) 2021.11.25
리눅스 find  (0) 2021.06.30

댓글