01 exportfs란
1. 정의
- NFS (Network File System) 파일 시스템을 내보내는(export) 테이블을 관리(maintain)하는 명령어
- 로컬 디렉토리를 NFS 클라이언트가 마운트할 수 있게 함
2. 문법
/usr/sbin/exportfs [-avi] [-o options,..] [client:/path ..]
/usr/sbin/exportfs -r [-v]
/usr/sbin/exportfs [-av] -u [client:/path ..]
/usr/sbin/exportfs [-v]
/usr/sbin/exportfs -f
3. 설명
- An NFS server maintains a table of local physical file systems that are accessible to NFS clients.
- Each file system in this table is referred to as an exported file system (or 'export').
- This table (called Master Export Table) is kept in a file name etab ( /var/lib/nfs/etab)
- The exportfs command maintains the current table of exports for the NFS server.
- Master export table (etab)
- master export table is kept in a file named /var/lib/nfs/etab
- This file is read by rpc.mountd when a client sends an NFS MOUNT request
- Normally the master export table is initialized with the contents of /etc/exports by invoking exportfs -a (참조: 02 exportfs 사용)
- However, a system administrator can choose to add or delete exports without modifying /etc/exports by using the exportfs command
- exportfs and its partner program rpc.mountd work in one of two modes:
mode | 설명 |
legacy mode (in Linux kernel 2.4 and earlier versions) |
- exports which identify a specific host, rather than a subnet or netgroup, are entered directly into the kernel's export table, as well as being written to /var/lib/nfs/etab - Further, exports listed in /var/lib/nfs/rmtab which match a non host-specific export request will cause an appropriate export entry for the host given in rmtab to be added to the kernel's export table |
new mode (in Linux kernel 2.6 and later) |
- provides nfsd virtual filesystem (which has been mounted at /proc/fs/nfsd 또는 /proc/fs/nsf) - if virtual filesystem is not mounted on 2.6 kernels, the legacy mode is used - does not give any information to the kernel, but provides it only to rpc.mountd through the /var/lib/nfs/etab file - rpc.mountd then manages kernel requests for info about exports, as needed |
4. 옵션
종류 | 설명 |
-a | 모든 디렉토리를 export 또는 unexport |
-o options, ... | export 옵션 리스트를 지정 (exports와 같이) |
-i | /etc/exports 파일 무시. 옵션 기본값과 명령줄에서 사용된 옵션들만 실행 |
-r | - /var/lib/nfs/etab 와 /etc/exports 파일들을 동기화하며 모든 디렉토리를 다시 export (reexport) - removes entries in /var/lib/nfs/etab which have been deleted from /etc/exports - removes any entries from the kernel export table which are no longer valid |
-u | 하나 이상의 디렉토리를 unexport |
-f | - if /proc/fs/nfsd or /proc/fs/nfs is mounted, flush everything out of the kernel's export table - fresh entries for active clients are added to the kernel's export table by rpc.mountd when they make their next NFS mount request |
-v | - verbose 모드 - exporting 또는 unexporting 시 무슨 일이 일어나는지 출력 - current export list 출력 시, list of export options 또한 출 |
02 exportfs 사용
1. 디렉토리 export
1) 모든 디렉토리 export
# exportfs -a
- all exports listed in /etc/exports are added to /var/lib/nfs/etab
- the kernel's export table is also updated as needed
2. 디렉토리 unexport
1) 모든 디렉토리 unexport
# exportfs -ua
- all entries listed in /var/lib/nfs/etab are removed from the kernel export tables, and the file is cleared
- effectively shuts down all NFS activity
참조
'OS 운영체제 > LINUX' 카테고리의 다른 글
NFS란 (네트워크 파일 시스템) (0) | 2024.05.02 |
---|---|
/etc/fstab (mount 설정 파일) (0) | 2024.05.02 |
chkconfig (실행 프로그램 설정 도구) (0) | 2024.04.30 |
nohup (터미널 끊겨도 proc 진행 시키는 명령어) (0) | 2024.04.29 |
rpm과 yum (패키지 설치 도구) (1) | 2024.04.26 |