NFS: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
(Phase 0.4: Expand NFS)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
NFS - "Network File System" - developed by Sun MicroSystem is the most widely used HPC to share filesystem. It is very easy to set up and performs reasonably well for small to medium clusters as primary storage. You can even use it for larger clusters too.
= NFS =


along with [[Samba|SMB]], NFS serves essentially the same purpose as SMB to access files systems over a network as if they were local.
{{Status
|status=Draft
|owner=Knowledge Agent
|last_update=2026-07-15
|review=Pending
}}


{{TOC}}


One of the most common questions about NFS configuration is how to tune it for performance and management and what options are typically used. So it is important to know them NFS export and mount options especially when you are facing a performance issue or a functional issue with the NFS mount over network.
== Overview ==
== Basic command ==
 
{| class="wikitable sortable"
NFS(Network File System)는 Sun Microsystems에서 개발한 네트워크 파일 공유 시스템입니다. SMB/SMB와 함께 네트워크 상의 파일 시스템을 로컬 파일 시스템처럼 접근할 수 있게 해주는 가장 널리 사용되는 HPC 스토리지 솔루션입니다.
|+
 
!Commands
=== Summary ===
!Description
 
!Command on
* 무엇인가? — 네트워크 파일 공유 프로토콜 (TCP/IP 기반)
* 왜 필요한가? — 중앙 집중식 스토리지, 다수 클라이언트 공유, 간단한 설정
* 언제 사용하는가? — HPC 클러스터, 파일 서버, 스토리지 공유
 
 
== Purpose ==
 
이 문서가 존재하는 이유
 
* Goal: NFS 버전, 서버/클라이언트 설정, 마운트 옵션, 성능 튜닝 제공
* Scope: NFS v2~v4.2, export/mount 옵션, 성능 최적화, 서비스 의존성
* Non-goals: NFS 커널 패치 개발, NFSv4.3+ 최신 기능은 별도 문서
 
 
== Key Concepts ==
 
{| class="wikitable"
! Concept
! Description
! Related
|-
|-
|# exportfs -r 
| NFSv4
|Re-export your shares
| 상태(Stateful) 기반 NFS — 단일 포트 2049
|Server
| [[NFS]]
|-
|-
|# exportfs -a 
| pNFS
|Export your shares
| Parallel NFS — 다수 서버 스트라이핑
|Server
| [[NFS]]
|-
|-
|# exportfs -v
| exportfs
|Verify the NFS Share permissions
| NFS 공유 내보내기 명령어
|Server
| [[NFS]]
|-
|-
|$nfsstat -m
| mount options
|'''Verify Current NFS Mount Options''' 
| NFS 클라이언트 마운트 옵션
|Client
| [[NFS]]
|-
| rsize/wsize
| 읽기/쓰기 블록 크기
| [[NFS]]
|-
| nconnect
| 다중 TCP 연결 (커널 5.3+)
| [[NFS]]
|-
| FS-Cache
| NFS 클라이언트 로컬 캐싱
| [[NFS]]
|-
| root_squash
| 원격 루트 권한 제한
| [[NFS]]
|}
|}


== NFS export on Server<ref>https://www.golinuxcloud.com/unix-linux-nfs-mount-options-example/</ref> <ref>https://linux.die.net/man/5/exports</ref> ==
NFS exports options are the permissions '''that is applied on NFS Server''' when we create a NFS Share under <code>/etc/exports</code>


Here are most common(important) options that administrator must understand, full list of options are available on the [https://man7.org/linux/man-pages/man5/exports.5.html man pages]
== Architecture ==
 
NFS는 클라이언트-서버 아키텍처로 구성됩니다:
 
<syntaxhighlight lang="mermaid">
graph TD
    A[NFS Server] --> B[/etc/exports]
    A --> C[nfs-server.service]
    A --> D[nfs-mountd]
    A --> E[nfs-idmapd]
    B --> F[Shared Directory]
    G[NFS Client] --> H[mount -t nfs]
    G --> I[/etc/fstab]
    H --> J[NFS Server:2049]
    I --> J
</syntaxhighlight>
 
 
== Workflow ==
 
{| class="wikitable"
{| class="wikitable"
|+
! Stage
!Export Options
! Input
!NFS Server
! Output
!Default
|-
| Server Setup
| /etc/exports
| NFS Share
|-
| Client Mount
| mount -t nfs
| NFS Mount Point
|-
|-
|<code>secure/insecure</code>
| Performance Tuning
|'''NFSv4 only uses port 2049''' while to check the list of ports used by '''NFSv3 use in server port'''
| rsize/wsize/timeo
With <code>secure</code> the port number from which the client requests a mount must be lower than 1024.
| Optimized NFS
To allow client any available free port use <code>insecure</code> in the NFS share
|<code>secure</code>
|-
|-
|rw/ro
| Monitoring
|'''ro''' means '''read-only''' access to the NFS Share
| nfsstat / /proc/net/rpc/nfsd
| Performance Data
|}


'''rw''' means '''read write''' access to the NFS Share
|rw
|-
|root_squash/no_root_squash
|'''squash literally means to squash (destroy) the power of the remote root user.'''


== Detailed Explanation ==


<code>root_squash</code> prevents remote root users from having superuser (root) privileges on remote NFS-mounted volumes.
=== NFS 버전 ===


<code>no_root_squash</code> allows root user on the NFS client host to access the NFS-mounted directory with the same rights and privileges that the superuser would normally have
{| class="wikitable"
|root_squash
! Version
! Description
! Key Features
|-
| NFSv2
| RFC 1094 (1989)
| UDP만 지원, 2GB 파일 제한, 8KB 쓰기 제한
|-
| NFSv3
| RFC 1813 (1995)
| 대용량 파일 지원, TCP 지원, 56KB 트랜잭션
|-
| NFSv4
| RFC 3010/3530/7530
| 상태(Stateful), 단일 포트 2049, Kerberos 보안
|-
|-
|all_quash/no_all_squash
| NFSv4.1
|<code>all_squash</code> will map all User IDs (UIDs) and group IDs (GIDs) to the anonymous user. <code>all_squash</code> is useful for NFS-exported public FTP directories, news spool directories
| RFC 5661 (2010)
|<code>no_all_squash</code>
| pNFS(Parallel NFS), 블록/객체 접근, Windows Kerberos
|-
|-
|sync/aysnc
| NFSv4.2
|<code>sync</code> reply to requests are done only after the changes have been committed to stable storage
| RFC 7862
| 향상된 성능 및 기능
|}
 
=== NFS 서버 설정 ===


<code>async</code> allows the NFS server to violate the NFS protocol and reply to requests before any changes made by that request have been committed to stable storage
==== /etc/exports 옵션 ====


Using <code>aysnc</code> option usually improves performance, but at the cost that an unclean server restart (i.e. a crash) '''can cause data to be lost or corrupted'''
{| class="wikitable"
|sync
! Export Options
! NFS Server
! Default
|-
| secure/insecure
| NFSv4는 포트 2049만 사용. NFSv3는 서버 포트 사용. secure: 클라이언트 포트 < 1024. insecure: 모든 포트 허용.
| secure
|-
| rw/ro
| rw: 읽기/쓰기. ro: 읽기 전용.
| rw
|-
| root_squash/no_root_squash
| root_squash: 원격 루트 권한 제한. no_root_squash: 원격 루트 전체 권한 허용.
| root_squash
|-
| all_squash/no_all_squash
| all_squash: 모든 UID/GID를 anonymous로 매핑.
| no_all_squash
|-
| sync/async
| sync: 변경사항 저장 후 응답. async: 저장 전 응답 (성능 ↑, 데이터 손실 위험).
| sync
|-
| insecure_locks
| 파일 잠금 시 클라이언트 자격 증명 불필요 (보안 위험).
| —
|}
|}


=== Check exports list and options ===
==== export 명령어 ====
 
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#with following set
# 공유 내보내기
$ cat /etc/exports
$ exportfs -a
/nas * (rw,sync,no_subtree_check)
 
# 공유 다시 내보내기
$ exportfs -r


# 공유 권한 확인
$ exportfs -v
# 현재 NFS 서비스 포트 확인
$ rpcinfo -p | grep -i nfs
$ rpcinfo -p | grep -i nfs
    100003    3  tcp  2049  nfs
    100003    4  tcp  2049  nfs
    100003    3  udp  2049  nfs
   
# detailed export status with default export options
$ sudo exportfs -v
/nas  <world>(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
</syntaxhighlight>
</syntaxhighlight>


== Ubuntu NFS service dependency<ref>https://ubuntu.com/server/docs/service-nfs</ref> ==
==== export 예시 ====
 
<syntaxhighlight lang="bash">
# /etc/exports
/srv/nfs4        192.168.33.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)
/srv/nfs4/backups 192.168.33.0/24(ro,sync,no_subtree_check) 192.168.33.3(rw,sync,no_subtree_check)
/srv/nfs4/www    192.168.33.20(rw,sync,no_subtree_check)
</syntaxhighlight>
 
=== Ubuntu NFS 서비스 의존성 ===
 
{| class="wikitable"
{| class="wikitable"
!Service
! Service
!nfs-utils.service
! nfs-utils.service
!nfs-server.service
! nfs-server.service
!config file (22.04)
! Config File (22.04)
!config file (< 22.04) /etc/default/nfs-*
! Config File (< 22.04)
|-
|-
|nfs-blkmap
| nfs-blkmap
|PartOf
| PartOf
|
|
|nfs.conf
| nfs.conf
|
|
|-
|-
|nfs-mountd
| nfs-mountd
|
|
|BindsTo
| BindsTo
|nfs.conf
| nfs.conf
|nfs-kernel-server
| nfs-[[kernel]]-server
|-
|-
|nfsdcld
| nfsdcld
|
|
|
|
|
|
|
|
|-
|-
|nfs-idmapd
| nfs-idmapd
|
|
|BindsTo
| BindsTo
|nfs.conf, idmapd.conf
| nfs.conf, idmapd.conf
|idmapd.conf
| idmapd.conf
|-
|-
|rpc-gssd
| rpc-gssd
|PartOf
| PartOf
|
|
|nfs.conf
| nfs.conf
|
|
|-
|-
|rpc-statd
| rpc-statd
|PartOf
| PartOf
|
|
|nfs.conf
| nfs.conf
|nfs-common
| nfs-common
|-
|-
|rpc-svcgssd
| rpc-svcgssd
|PartOf
| PartOf
|BindsTo
| BindsTo
|nfs.conf
| nfs.conf
|nfs-kernel-server
| nfs-kernel-server
|}
|}


== NFS Client mount options<ref>https://www.thegeekdiary.com/common-nfs-mount-options-in-linux/</ref> ==
=== NFS 클라이언트 마운트 옵션 ===
<nowiki>#</nowiki> mount -t nfs -o [options] remote:/nfs /mount


{| class="wikitable"
{| class="wikitable"
|+
! Mount Options
!Mount Options
! NFS Client
!NFS Client
! Default
!Default  
! Notes
!Notes
|-
|-
|'''nfsvers='''''n or'' vers=n
| nfsvers/vers=n
|The version of the NFS protocol to use. By default, the local NFS client will attempt to mount the file system using NFS version 3. If the NFS server does not [[support]] version 3, the file system will be mounted using version 2.
| 사용할 NFS 버전. 기본값 3.
If you know that the NFS server does not support version 3, specify vers=2, and you will save time during the mount, because the client will not attempt to use version 3 before using version 2
| 3, 4
|3
|
|
|-
|-
|rw (read/write) / ro (read-only)
| rw/ro
|
| rw: 읽기/쓰기. ro: 읽기 전용.
* Use rw for data that users need to modify. In order for you to mount a directory read/write, the NFS server must export it read/write.
| rw
* Use ro for data you do not want users to change. A directory that is automounted from several servers should be read-only, to keep versions identical on all servers.
|
|rw.
|
|-
|-
|suid / nosuid
| suid/nosuid
|
| suid: setuid 프로그램 허용. nosuid: setuid 차단.
* Specify suid if you want to allow mounted programs that have setuid permission to run with the permissions of their owners, regardless of who starts them. If a program with setuid permission is owned by root, it will run with root permissions, regardless of who starts it.
| suid
* Specify nosuid to protect your system against setuid programs that may run as root and damage your system.
|
|suid
|
|-
|-
|hard / soft
| hard/soft
|
| hard: 서버 다운 시 재시도 (프로세스 대기). soft: 재시도 후 에러 반환.
* Specify hard if users will be writing to the mounted directory or running programs located in it. When NFS tries to access a hard-mounted directory, it keeps trying until it succeeds or someone interrupts its attempts. If the server goes down, any processes using the mounted directory hang until the server comes back up and then continue processing without errors. Interruptible hard mounts may be interrupted with CTRL-C or kill (see the intr option, later).
| hard
* Specify soft if the server is unreliable and you want to prevent systems from hanging when the server is down. When NFS tries to access a soft-mounted directory, it gives up and returns an error message after trying retrans times (see the retrans option, later). Any processes using the mounted directory will return errors if the server goes down.
|
|hard
|
|-
|-
|<code>nconnect=<value></code>
| nconnect=value
|NFS-over-TCP mount for one or more NFS shares from an individual NFS server, the traditional behavior is that all those mounts share one TCP connection if they are using the same NFS protocol version.  In cases of high NFS work load at the client, this connection sharing may result in lower performance or unnecessary bottlenecks.<ref>https://www.suse.com/support/kb/doc/?id=000019933</ref>
| 다중 TCP 연결 (커널 5.3+). 최대 16.
|16
| 16
|In [[Linux]] kernel 5.3 (and higher), the <code>nconnect</code> option allows multiple TCP connections for a single NFS mount.
| 성능 향상
|-
|-
|intr / nointr
| intr/nointr
|
| intr: NFS 요청 중단 가능. nointr: 중단 불가.
* Specify intr if users are not likely to damage critical data by manually interrupting an NFS request. If a hard mount is interruptible, a user may press [CTRL]-C or issue the kill command to interrupt an NFS mount that is hanging indefinitely because a server is down.
| intr
* Specify nointr if users might damage critical data by manually interrupting an NFS request, and you would rather have the system hang while the server is down than risk losing data between the client and the server.
| Linux 2.6.25+ deprecated
|intr
|In Linux kernel 2.6.25 (and higher), the <code>intr</code> and <code>nointr</code> mount options are deprecated. If you use the <code>hard</code> option on modern Linux kernels, you must use the <code>kill -9</code> <code>(SIGKILL)</code> command to interrupt a stuck NFS mount.
|-
|-
|fg (foreground) / bg (background)
| fg/bg
|
| fg: 부팅 필수 마운트. bg: 백그라운드 마운트.
* Specify fg for directories that are necessary for the client machine to boot or operate correctly. If a foreground mount fails, it is retried again in the foreground until it succeeds or is interrupted. All automounted directories are mounted in the foreground; you cannot specify the bg option with automounted directories.
| fg
* Specify bg for mounting directories that are not necessary for the client to boot or operate correctly. Background mounts that fail are re-tried in the background, allowing the mount process to consider the mount complete and go on to the next one. If you have two machines configured to mount directories from each other, configure the mounts on one of the machines as background mounts. That way, if both systems try to boot at once, they will not become deadlocked, each waiting to mount directories from the other. The bg option cannot be used with automounted directories.
|
|fg
|
|-
|-
|devs / nodevs
| devs/nodevs
|
| devs: 장치 파일 허용. nodevs: 장치 파일 차단.
* Specify devs if you are mounting device files from a server whose device files will work correctly on the client. The devs option allows you to use NFS-mounted device files to read and write to devices from the NFS client. It is useful for maintaining a standard, centralized set of device files, if all your systems are configured similarly.
| devs
* Specify nodevs if device files mounted from a server will not work correctly for reading and writing to devices on the NFS client. The nodevs option generates an error if a process on the NFS client tries to read or write to an NFS-mounted device file.
|
|devs
|
|-
|-
|timeo=n
| timeo=n
|The ''timeo'' (timeout) option is the amount of time the NFS client waits on the NFS server before retransmitting a packet (no ACK received). The value for ''timeo'' is given in tenths of a second, so if ''timeo'' is ''5'', the NFS client will wait 0.5 seconds before retransmitting
| 재전송 대기 시간 (0.1초 단위). 최대 30 (3초).
The timeout, in tenths of a second, for NFS requests (read and write requests to mounted directories). If an NFS request times out, this timeout value is doubled, and the request is retransmitted. After the NFS request has been retransmitted the number of times specified by the retrans option, a soft mount returns an error, and a hard mount retries the request. The maximum timeo value is 30 (3 seconds).
| 0.7
– Try doubling the timeo value if you see several servers not responding messages within a few minutes. This can happen because you are mounting directories across a gateway, because your server is slow, or because your network is busy with heavy traffic.
|
|The default is ''0.7'' (0.07 seconds)
|
|-
|-
|retrans=n
| retrans=n
|''retrans'', specifies the number of tries the NFS client will make to retransmit the packet. If the value is ''5'', the client resends the RPC packet five times, waiting ''timeo'' seconds between tries. If, after the last attempt, the NFS server does not respond, you get a message ''Server not responding''.
| 재전송 횟수.
The number of times an NFS request (a read or write request to a mounted directory) is retransmitted after it times out. If the request does not succeed after n retransmissions, a soft mount returns an error, and a hard mount retries the request.
| 4
Increase the retrans value for a directory that is soft-mounted from a server that has frequent, short periods of downtime. This gives the server sufficient time to recover, so the soft mount does not return an error
|
|4
|
|-
|-
|retry=n
| retry=n
|The number of times the NFS client attempts to mount a directory after the first attempt fails. If you specify intr, you can interrupt the mount before n retries. However, if you specify nointr, you must wait until n retries have been made, until the mount succeeds, or until you reboot the system.
| 마운트 재시도 횟수.
If mounts are failing because your server is very busy, increasing the retry value may fix the problem
| 1
|1
|
|
|-
|-
|rsize=n
| rsize=n
|The number of bytes the NFS client requests from the NFS server in a single read request.
| 읽기 블록 크기.
If packets are being dropped between the client and the server, decrease rsize to 4096 or 2048. To find out whether packets are being dropped, issue the “nfsstat -rc” command at the HP-UX prompt. If the timeout and retrans values returned by this command are high, but the badxid number is close to zero, then packets are being dropped somewhere in the network.
| 8192
|8192
|
|
|-
|-
|wsize=n
| wsize=n
|The number of bytes the NFS client sends to the NFS server in a single write request.
| 쓰기 블록 크기.
If packets are being dropped between the client and the server, decrease wsize to 4096 or 2048. To find out whether packets are being dropped, issue the “nfsstat -rc” command at the HP-UX prompt. If the timeout and retrans values returned by this command are high, but the badxid number is close to zero, then packets are being dropped somewhere in the network.
| 8192
|8192
|
|
|-
|-
|O (Overlay mount)
| noac
|Allows the file system to be mounted over an existing mount point, making the underlying file system inaccessible. If you attempt to mount a file system over an existing mount point without the -O option, the mount will fail with the error device busy.
| 속성 캐싱 비활성화.
'''Caution''': Using the -O mount option can put your system in a confusing state. The -O option allows you to hide local data under an NFS mount point without receiving any warning. Local data hidden beneath an NFS mount point will not be backed up during regular system backups.
| —
| —
|-
| actimeo=n
| 모든 캐싱 타임아웃 설정.
| —
| —
|-
| lock/nolock
| NLM 파일 잠금 사용 여부.
| lock
| —
|-
| local_lock=mechanism
| 로컬 잠금 방식 (all/flock/posix/none).
| —
| 커널 2.6.37+
|}
 
=== NFS 성능 최적화 ===


On HP-UX, the -O option is valid only for NFS-mounted file systems. For this reason, if you specify the -O option, you must also specify the -F nfs option to the mount command or the nfs file system type in the [[Fstab|/etc/fstab]] file.
{| class="wikitable"
|The default value is not specified
! Tuning Options
|
! Target
! Description
! Recommendation
|-
| sync/async
| 클라이언트
| mount 또는 /etc/fstab에서 설정
|
|-
|-
|remount
| nfsd 수
|If the file system is mounted read-only, this option remounts it read/write. This allows you to change the access permissions from read-only to read/write without forcing everyone to leave the mounted directory or killing all processes using it
| 서버
|The Default value is not specified
| /proc/net/rpc/nfsd로 스레드 부하 확인
|
| 16C/128GB: 256, 8C/64GB: 64
|-
|-
|noac
| rsize/wsize
|If specified, this option prevents the NFS client from caching attributes for the mounted directory.
| 클라이언트
Specify noac for a directory that will be used frequently by many NFS clients. The noac option ensures that the file and directory attributes on the server are up to date, because no changes are cached on the clients. However, if many NFS clients using the same NFS server all disable attribute caching, the server may become overloaded with attribute requests and updates. You can also use the actimeo option to set all the caching timeouts to a small number of seconds, like 1 or 3.
| 읽기/쓰기 블록 크기
 
| /etc/fstab에서 rsize=131072, wsize=131072
If you specify noac, do not specify the other caching options.
|-
|The Default value is not specified
| timeo/retrans
|
| 클라이언트
| 네트워크 혼잡 시 재전송 설정
| timeo=900, retrans=5
|-
|-
|nocto
| FS-Cache
|If specified, this option suppresses fresh attributes when opening a file.
| 클라이언트
Specify nocto for a file or directory that never changes, to decrease the load on your network
| 로컬 스토리지에 NFS 읽기 캐싱 (-o fsc)
|The Default value is not specified
| 읽기 작업에 효과적
|
|-
|-
|acdirmax=n
| noatime/nodiratime
|The maximum number of seconds a directory’s attributes are cached on the NFS client. When this timeout period expires, the client flushes its attribute cache, and if the attributes have changed, the client sends them to the NFS server.
| 클라이언트
For a directory that rarely changes or that is owned and modified by only one user, like a user’s home directory, you can decrease the load on your network by setting acdirmax=120 or higher
| inode 접근 시간 업데이트 방지
|60
| 성능 향상
|
|-
|-
|acdirmin=n
| System Memory
|The minimum number of seconds a directory’s attributes are cached on the NFS client. If the directory is modified before this timeout expires, the timeout period is extended by acdirmin seconds.
| 서버
For a directory that rarely changes or that is owned and modified by only one user, like a user’s home directory, you can decrease the load on your network by setting acdirmin=60 or higher
| async 모드 시 메모리 확보 필요
|30
| 가능한 많은 메모리
|
|-
|-
|acregmax=n
| Network MTU
|The maximum number of seconds a file’s attributes are cached on the NFS client. When this timeout period expires, the client flushes its attribute cache, and if the attributes have changed, the client sends them to the NFS server.
| 서버+클라이언트
For a file that rarely changes or that is owned and modified by only one user, like a file in a user’s home directory, you can decrease the load on your network by setting acregmax=120 or higher
| MTU 1500 → 9000 (Jumbo Packet)
|60
| 대역폭 33% 증가
|
|-
|-
|actimeo=n
| TCP tuning
|Setting actimeo to n seconds is equivalent to setting acdirmax, acdirmin, acregmax, and acregmin to n seconds.
| 서버
Set actimeo=1 or actimeo=3 for a directory that is used and modified frequently by many NFS clients. This ensures that the file and directory attributes are kept reasonably up to date, even if they are changed frequently from various client locations.
| net.core.rmem/wmem 설정
 
| 262144 (256KiB)
Set actimeo=120 or higher for a directory that rarely or never changes.
 
If you set the actimeo value, do not set the acdirmax, acdirmin, acregmax, or acregmin values
|The Default value is not specified
|
|-
|-
|grpid
| subtree_check
|Forces a newly created file in the mounted file system to inherit the group ID of the parent directory.
| 서버
By default, a newly created file inherits the effective group ID of the calling process, unless the GID bit is set on the parent directory. If the GID bit is set, the new file inherits the group ID of the parent directory
| export된 폴더 내 파일 확인
|The Default value is not specified
| 보안 ↑, 성능 ↓
|
|-
|-
|'''lock''' / '''nolock'''
| root_squash
|
| 서버
; Selects whether to use the NLM sideband protocol to lock files on the server. If neither option is specified (or if '''lock''' is specified), NLM locking is used for this mount point. When using the '''nolock''' option, applications can lock files, but such locks provide exclusion only against other applications running on the same client. Remote applications are not affected by these locks.
| 원격 루트 권한 제한
| 보안 ↑
|}


NLM locking must be disabled with the '''nolock''' option when using NFS to mount ''/var'' because ''/var'' contains files used by the NLM implementation on Linux. Using the '''nolock''' option is also required when mounting exports on NFS servers that do not support the NLM protocol.  
=== NFS v4.1/v4.2 권장 ===
|
|
|-
|'''local_lock='''mechanism
|Specifies whether to use local locking for any or both of the flock and the POSIX locking mechanisms. ''mechanism'' can be one of '''all''', '''flock''', '''posix''', or '''none'''.
The Linux NFS client provides a way to make locks local. This means, the applications can lock files, but such locks provide exclusion only against other applications running on the same client. Remote applications are not affected by these locks.


If '''all''' is specified, the client assumes that both flock and POSIX locks are local.
<syntaxhighlight lang="bash">
# NFS v4.2 마운트
$ mount -o nfsvers=4.2 srvr:/export /mountpoint


If '''flock''' is specified, the client assumes that only flock locks are local and uses NLM sideband protocol to lock files when POSIX locks are used.
# 또는
$ mount -o nfsvers=4,minorversion=2 srvr:/export /mountpoint
</syntaxhighlight>


If '''posix''' is specified, the client assumes that POSIX locks are local and uses NLM sideband protocol to lock files when flock locks are used.
=== rsize/wsize 설정 ===


To support legacy flock behavior similar to that of NFS clients < 2.6.12, use [[Samba]] as Samba maps Windows share mode locks as flock. Since NFS clients > 2.6.12 implement flock by emulating POSIX locks, this will result in conflicting locks.
<syntaxhighlight lang="bash">
# /etc/fstab
srvr1:/usr/local  /usr/local  nfs  nfsvers=4.2,rsize=131072,wsize=131072  0  0


|'''none'''
# systemd automount
|This option is supported in kernels 2.6.37 and later.
srvr1:/usr/local  /usr/local  nfs  noauto,x-systemd.automount,nfsvers=4.2,rsize=131072,wsize=131072  0  0
NOTE: When used together, the 'local_lock' mount option will be overridden by 'nolock'/'lock' mount option.  
</syntaxhighlight>
|}


== Optimizing NFS Performance<ref>https://nfs.sourceforge.net/nfs-howto/ar01s05.html</ref> ==
=== 권장 마운트 옵션 ===
Tuning for performance is a loaded question because performance is defined by so many different variables, the most important of which is how to measure performance.


{| class="wikitable"
{| class="wikitable"
|+
! Condition
!Tunning Options
! Recommended Options
!Target
!Description
!Recommendation
|-
|-
| rowspan="6" |NFS performance
| Server-Side NLM Enabled
|Synchronous vs asynchronous
| <syntaxhighlight>mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,rdirplus,readahead=128 server:/path mountpath</syntaxhighlight>
|See above
|sync for data integrity
to take effect remount
|-
|-
|Number of NFS daemons (''nfsd'')
| Local Locking Enforced
|One way to determine whether more NFS threads helps performance is to check the data in ''cat /proc/net/rpc/nfsd (Ubuntu)'' for the load on the NFS daemons.  
| <syntaxhighlight>mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,locallocks,rdirplus,readahead=128 server:/path mountpath</syntaxhighlight>
The output line that starts with ''th'' lists the number of threads, and the last 10 numbers are a histogram of the number of seconds the first 10% of threads were busy, the second 10%, and so on.
|}
 
 
== Configuration ==
 
<syntaxhighlight lang="bash">
# NFS 서버 설정
$ sudo systemctl enable nfs-server
$ sudo systemctl start nfs-server
 
# /etc/exports 설정
$ echo "/srv/nfs4 192.168.1.0/24(rw,sync,no_subtree_check)" | sudo tee -a /etc/exports
$ sudo exportfs -r
 
# NFS 클라이언트 마운트
$ sudo mount -t nfs -o vers=4.1 192.168.1.10:/srv/nfs4 /mnt/nfs
 
# /etc/fstab에 추가
$ echo "192.168.1.10:/srv/nfs4 /mnt/nfs nfs nfsvers=4.1,defaults,nofail,timeo=900,retrans=5,_netdev 0 0" | sudo tee -a /etc/fstab
</syntaxhighlight>
 
 
== Examples ==
 
=== Example 1: NFS 서버 설정 ===
 
<syntaxhighlight lang="bash">
# NFS 서버 설치
$ sudo apt-get install nfs-kernel-server
 
# /etc/exports 설정
$ sudo tee /etc/exports << EOF
/srv/nfs4 192.168.1.0/24(rw,sync,no_subtree_check)
EOF
 
# NFS 서비스 시작
$ sudo systemctl enable nfs-server
$ sudo systemctl start nfs-server
 
# 공유 내보내기
$ sudo exportfs -r
$ sudo exportfs -v
</syntaxhighlight>
 
=== Example 2: NFS 클라이언트 마운트 ===
 
<syntaxhighlight lang="bash">
# NFS 마운트
$ sudo mount -t nfs -o vers=4.1 192.168.1.10:/srv/nfs4 /mnt/nfs
 
# 마운트 옵션 확인
$ cat /proc/mounts | grep nfs
 
# NFS 상태 확인
$ nfsstat -m
</syntaxhighlight>
 


== Best Practices ==


* NFS v4.2 사용 (최신 버전)
* rsize/wsize=131072 설정 (대용량 전송)
* nconnect=16 사용 (다중 TCP 연결)
* MTU 9000 (Jumbo Packet) 적용
* sync 옵션 사용 (데이터 무결성)
* root_squash 활성화 (보안)
* FS-Cache 활성화 (읽기 성능)
* noatime/nodiratime 설정 (성능)
* 정기적인 nfsstat 모니터링


[https://svennd.be/nfsd-stats-explained-procnetrpcnfsd/ this page] explain how to part the contents of ''/proc/net/rpc/nfsd.''


== Limitations ==


* NFSv2: 2GB 파일 제한, UDP만 지원
* NFSv3: 상태(Stateless) — 서버 재시작 시 세션 손실
* NFSv4: Kerberos 설정 복잡
* 네트워크 지연에 민감
* 대용량 파일 동시 접근 시 병목
* NFS 서버 단일 장애점 (SPOF)


Ideally, you want the last two numbers to be zero or close to zero, indicating that the threads are busy and you are not "wasting" any threads. If the last two numbers are fairly high, you should add NFS daemons, because the NFS server has become the bottleneck. If the last two, three, or four numbers are zero, then some threads are probably not being used<ref>https://www.admin-magazine.com/HPC/Articles/Useful-NFS-Options-for-Tuning-and-Management</ref>


on Ubuntu, ''RPCNFSDCOUNT in /etc/default/nfs-kernel-server file'' tells you the number of NFS daemons for the server
== References ==


''in addition, for tuning how many threads are needed you could look at : /proc/fs/nfsd/pool_stats''
* https://en.wikipedia.org/wiki/Network_File_System
|256 on 16C/128GB
* https://nfs.sourceforge.net/nfs-howto/ar01s05.html
64 on 8C/64GB
* https://www.admin-magazine.com/HPC/Articles/Useful-NFS-Options-for-Tuning-and-Management
* https://ubuntu.com/server/docs/service-nfs




to take effect reboot system<ref>https://ubuntuforums.org/showthread.php?t=2345636</ref>
== Related Pages ==
|-
|'''Block Size Setting'''
|Two NFS client options specify the size of data chunks for writing (''wsize'') and reading (''rsize''). If you don't specify the chunk sizes, the defaults are determined by the versions of NFS and the kernel being used
the best way to check the current chunk size is to run the command on the NFS client and look for the ''wsize'' and ''rsize'' values.


$cat /proc/mounts
* [[Samba]]
|
* [[Storage]]
|-
* [[Linux]]
|'''Timeout and Retransmission'''
* [[Network]]
|On congested networks, you often see retransmissions of RPC packets. A good way to tell is to run the
* [[Fstab]]
nfsstat -r
command and look for the column labeled ''retrans''. If the number is large, the network is likely very congested. If that is the case, you might want to increase the values of ''timeo'' and ''retrans'' to increase the number of tries and the amount of time between RPC tries. Although taking this action will slow down NFS performance, it might help even out the [[network traffic]] so that congestion is reduced. In my experience, getting rid of congestion and dropped packets can result in better, more even performance
|
|-
|'''FS-Cache'''
|FS-Cache option enable caches NFS client requests on a local storage device, such as a hard drive or SSD, helping improve NFS read I/O: Data that resides on the local NFS client means the NFS server does not have to be contacted.
To use NFS caching you have to enable it explicitly by adding the option ''-o fsc'' to the ''mount'' command or in ''[[Fstab|/etc/fstab]]:''
# mount <nfs-share>:/ </mount/point> -o fsc
Any data access to <''/mount/point>'' will go through the NFS cache unless the file is opened for direct I/O or if a write I/O is performed.


The important thing to remember is that FS-Cache only works if the I/O is a read. FS-Cache can't help with a direct I/O (read or write) or an I/O write request. However, there are plenty of cases in which FS-Cache can help. For example, if you have an application that needs to read from a database or file and you are running a large number of copies of the same application, FS-Cache might help, because each node could cache the database or file.
|
|-
|Filesystem-independent mount options
|''Linux mount'' command has a number of options that are independent of the filesystem and might be able to improve performance


* '''''noatime''''' – Inode access times are not updated on the filesystem. This can help performance because the access time of the file is not updated every time a file is accessed.
[[Category:Server]]
* '''''nodiratime''''' – The directory inode is not updated on the filesystem when it is accessed. This can help performance in the same way as not updating the file access time.
== Knowledge Graph ==
* '''''relatime''''' – Inode access times are relative to the modify or change time for the file, so the access time is updated only if the previous ''atime'' (access time) was earlier than the modify or change time.
|
|-
| rowspan="3" |System tuning
|'''System Memory'''
|If you are choosing to use asynchronous NFS mode, you will need more memory to take advantage of ''async,'' because the NFS server will first store the I/O request in memory, respond to the NFS client, and then retire the I/O by having the filesystem write it to stable storage. Therefore, you need as much memory as possible to get the best performance.
|
|-
|MTU
|Changing the network MTU (maximum transmission unit) is also a good way to affect performance, but it is not an NFS tunable.
The MTU size can be very important because it determines packet fragments on the network. If your chunk size is 8KB and the MTU is ''1500'', it will take six Ethernet frames to transmit the 8KB. If you increase the MTU to ''9000'' (9,000 bytes), the number of Ethernet frames drops to one.


A study by Dell a few years back examined the effect of an MTU of ''1500'' compared with an MTU of ''9000''. Using Netperf, they found that the bandwidth increased by about 33% when an MTU of ''9000'' was used
Related


Fortunatly most switches can accommodate an MTU of ''9000'' (commonly called "jumbo packets")
→ [[Network]]
|
→ [[NFSv4 ACLs]]
|-
→ [[Storage]]
|TCP tuning on the server
|The NFS server NFS daemons share the same socket input and output queues, so if the queues are larger, all of the NFS daemons have more buffer and can send and receive data much faster.
the two values to increase queues for input and output are defined the value in
''/proc/sys/net/core/rmem_default'' (the default size of the read queue in bytes)
''/proc/sys/net/core/rmem_max'' (the maximum size of the read queue in bytes)


To make the values survive reboots, you need to enter them in the proper form in the ''/etc/sysctl.conf'' file or /etc/sysctl.d/somefile
[[Category:Reference]]
|
|-
| rowspan="2" |NFS management/policy
|Subtree checking
|''subtree_check'' to the exports on the NFS server checks that the file being accessed is contained within the exported directory and force the NFS server to check that the requested file was located within exported folder
Many people have the opinion that ''subtree_check'' can have a big effect on performance, but the final determination is up to that is performance more important than security for the configuration and your situation


For security, it is recommended to export folders which uses separate partition or separate drive to prevent a rogue user from guessing a file handle to anything outside of the filesystem
== NFSv4.2 Features ==
|
|-
|Root squashing
|if you want ''root'' to have access to an NFS-mounted filesystem, you can add the option ''no_root_squash'' to the file ''/etc/exports'' to allow root access. Just be aware that if someone reboots your system to gain root access, it's possible for them to copy (steal) data.
|}


=== Setting Block Size to Optimize Transfer Speeds ===
NFSv4.2는 NFS 최신 버전. 여러 성능 개선 기능 포함.
The mount command options '''<code>rsize</code>''' and '''<code>wsize</code>''' specify the size of the chunks of data that the client and server pass back and forth to each other.


== Mount Options Example<ref>https://care.qumulo.com/hc/en-us/articles/115008111268-Recommended-NFS-Mount-Options#recommended-mount-options-for-linux-0-5</ref> ==
=== PFCP (Parallel NFS) ===


* In Linux kernel 5.3 (and higher), the <code>nconnect</code> option allows multiple TCP connections for a single NFS mount. '''Note:''' Currently, the maximum number of concurrent TCP connections is 16.
* 파일 내 병렬 I/O. 큰 파일 처리 속도↑
* In Linux kernel 2.6.25 (and higher), the <code>intr</code> and <code>nointr</code> mount options are deprecated. If you use the <code>hard</code> option on modern Linux kernels, you must use the <code>kill -9</code> <code>(SIGKILL)</code> command to interrupt a stuck NFS mount.
* client-side caching. 로컬 캐시로 읽기 속도↑


{| class="wikitable"
<syntaxhighlight lang="bash">
|+
# PFCP 마운트 옵션
!Condition
mount -t nfs4 -o vers=4.2,cache=loose server:/share /mnt/nfs
!Recommended Options
|-
|'''Client with Server-Side Network Lock Manager (NLM) Enabled'''
|<syntaxhighlight lang="bash">
mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,rdirplus,readahead=128 server:/path mountpath
</syntaxhighlight>
</syntaxhighlight>
|-
 
|'''Client with Local Locking Enforced'''
=== RDMA-NFS (NFS over RDMA) ===
|<syntaxhighlight lang="bash">
 
mount -t nfs   -o rsize=65536,wsize=65536,intr,hard,tcp,locallocks,rdirplus,readahead=128 \ server:/path mountpath
* RDMA로 NFS 트래픽 전송. CPU 부하 ↓, 레이턴시 ↓
* IPoIB ([[InfiniBand]] over IP) 또는 RoCE 사용
 
<syntaxhighlight lang="bash">
# RDMA-NFS 마운트
mount -t nfs -o vers=4.2,rdma server:/share /mnt/nfs
 
# RDMA-NFS 성능 확인
nfsstat -m
</syntaxhighlight>
</syntaxhighlight>
|}


=== Copy Offload (COPY/DEDUP) ===
* 서버 사이드 복사. 네트워크 트래픽 없음
* 대용량 데이터 이동 시 효율적


== References ==
<syntaxhighlight lang="bash">
<references />
# 서버 사이드 복사
cp --reflink=auto /mnt/nfs/source /mnt/nfs/dest
</syntaxhighlight>

Latest revision as of 13:37, 17 July 2026

NFS

Template:Status

Template:TOC

Overview

NFS(Network File System)는 Sun Microsystems에서 개발한 네트워크 파일 공유 시스템입니다. SMB/SMB와 함께 네트워크 상의 파일 시스템을 로컬 파일 시스템처럼 접근할 수 있게 해주는 가장 널리 사용되는 HPC 스토리지 솔루션입니다.

Summary

  • 무엇인가? — 네트워크 파일 공유 프로토콜 (TCP/IP 기반)
  • 왜 필요한가? — 중앙 집중식 스토리지, 다수 클라이언트 공유, 간단한 설정
  • 언제 사용하는가? — HPC 클러스터, 파일 서버, 스토리지 공유


Purpose

이 문서가 존재하는 이유

  • Goal: NFS 버전, 서버/클라이언트 설정, 마운트 옵션, 성능 튜닝 제공
  • Scope: NFS v2~v4.2, export/mount 옵션, 성능 최적화, 서비스 의존성
  • Non-goals: NFS 커널 패치 개발, NFSv4.3+ 최신 기능은 별도 문서


Key Concepts

Concept Description Related
NFSv4 상태(Stateful) 기반 NFS — 단일 포트 2049 NFS
pNFS Parallel NFS — 다수 서버 스트라이핑 NFS
exportfs NFS 공유 내보내기 명령어 NFS
mount options NFS 클라이언트 마운트 옵션 NFS
rsize/wsize 읽기/쓰기 블록 크기 NFS
nconnect 다중 TCP 연결 (커널 5.3+) NFS
FS-Cache NFS 클라이언트 로컬 캐싱 NFS
root_squash 원격 루트 권한 제한 NFS


Architecture

NFS는 클라이언트-서버 아키텍처로 구성됩니다:

graph TD
    A[NFS Server] --> B[/etc/exports]
    A --> C[nfs-server.service]
    A --> D[nfs-mountd]
    A --> E[nfs-idmapd]
    B --> F[Shared Directory]
    G[NFS Client] --> H[mount -t nfs]
    G --> I[/etc/fstab]
    H --> J[NFS Server:2049]
    I --> J


Workflow

Stage Input Output
Server Setup /etc/exports NFS Share
Client Mount mount -t nfs NFS Mount Point
Performance Tuning rsize/wsize/timeo Optimized NFS
Monitoring nfsstat / /proc/net/rpc/nfsd Performance Data


Detailed Explanation

NFS 버전

Version Description Key Features
NFSv2 RFC 1094 (1989) UDP만 지원, 2GB 파일 제한, 8KB 쓰기 제한
NFSv3 RFC 1813 (1995) 대용량 파일 지원, TCP 지원, 56KB 트랜잭션
NFSv4 RFC 3010/3530/7530 상태(Stateful), 단일 포트 2049, Kerberos 보안
NFSv4.1 RFC 5661 (2010) pNFS(Parallel NFS), 블록/객체 접근, Windows Kerberos
NFSv4.2 RFC 7862 향상된 성능 및 기능

NFS 서버 설정

/etc/exports 옵션

Export Options NFS Server Default
secure/insecure NFSv4는 포트 2049만 사용. NFSv3는 서버 포트 사용. secure: 클라이언트 포트 < 1024. insecure: 모든 포트 허용. secure
rw/ro rw: 읽기/쓰기. ro: 읽기 전용. rw
root_squash/no_root_squash root_squash: 원격 루트 권한 제한. no_root_squash: 원격 루트 전체 권한 허용. root_squash
all_squash/no_all_squash all_squash: 모든 UID/GID를 anonymous로 매핑. no_all_squash
sync/async sync: 변경사항 저장 후 응답. async: 저장 전 응답 (성능 ↑, 데이터 손실 위험). sync
insecure_locks 파일 잠금 시 클라이언트 자격 증명 불필요 (보안 위험).

export 명령어

# 공유 내보내기
$ exportfs -a

# 공유 다시 내보내기
$ exportfs -r

# 공유 권한 확인
$ exportfs -v

# 현재 NFS 서비스 포트 확인
$ rpcinfo -p | grep -i nfs

export 예시

# /etc/exports
/srv/nfs4         192.168.33.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)
/srv/nfs4/backups 192.168.33.0/24(ro,sync,no_subtree_check) 192.168.33.3(rw,sync,no_subtree_check)
/srv/nfs4/www     192.168.33.20(rw,sync,no_subtree_check)

Ubuntu NFS 서비스 의존성

Service nfs-utils.service nfs-server.service Config File (22.04) Config File (< 22.04)
nfs-blkmap PartOf nfs.conf
nfs-mountd BindsTo nfs.conf nfs-kernel-server
nfsdcld
nfs-idmapd BindsTo nfs.conf, idmapd.conf idmapd.conf
rpc-gssd PartOf nfs.conf
rpc-statd PartOf nfs.conf nfs-common
rpc-svcgssd PartOf BindsTo nfs.conf nfs-kernel-server

NFS 클라이언트 마운트 옵션

Mount Options NFS Client Default Notes
nfsvers/vers=n 사용할 NFS 버전. 기본값 3. 3, 4
rw/ro rw: 읽기/쓰기. ro: 읽기 전용. rw
suid/nosuid suid: setuid 프로그램 허용. nosuid: setuid 차단. suid
hard/soft hard: 서버 다운 시 재시도 (프로세스 대기). soft: 재시도 후 에러 반환. hard
nconnect=value 다중 TCP 연결 (커널 5.3+). 최대 16. 16 성능 향상
intr/nointr intr: NFS 요청 중단 가능. nointr: 중단 불가. intr Linux 2.6.25+ deprecated
fg/bg fg: 부팅 필수 마운트. bg: 백그라운드 마운트. fg
devs/nodevs devs: 장치 파일 허용. nodevs: 장치 파일 차단. devs
timeo=n 재전송 대기 시간 (0.1초 단위). 최대 30 (3초). 0.7
retrans=n 재전송 횟수. 4
retry=n 마운트 재시도 횟수. 1
rsize=n 읽기 블록 크기. 8192
wsize=n 쓰기 블록 크기. 8192
noac 속성 캐싱 비활성화.
actimeo=n 모든 캐싱 타임아웃 설정.
lock/nolock NLM 파일 잠금 사용 여부. lock
local_lock=mechanism 로컬 잠금 방식 (all/flock/posix/none). 커널 2.6.37+

NFS 성능 최적화

Tuning Options Target Description Recommendation
sync/async 클라이언트 mount 또는 /etc/fstab에서 설정
nfsd 수 서버 /proc/net/rpc/nfsd로 스레드 부하 확인 16C/128GB: 256, 8C/64GB: 64
rsize/wsize 클라이언트 읽기/쓰기 블록 크기 /etc/fstab에서 rsize=131072, wsize=131072
timeo/retrans 클라이언트 네트워크 혼잡 시 재전송 설정 timeo=900, retrans=5
FS-Cache 클라이언트 로컬 스토리지에 NFS 읽기 캐싱 (-o fsc) 읽기 작업에 효과적
noatime/nodiratime 클라이언트 inode 접근 시간 업데이트 방지 성능 향상
System Memory 서버 async 모드 시 메모리 확보 필요 가능한 많은 메모리
Network MTU 서버+클라이언트 MTU 1500 → 9000 (Jumbo Packet) 대역폭 33% 증가
TCP tuning 서버 net.core.rmem/wmem 설정 262144 (256KiB)
subtree_check 서버 export된 폴더 내 파일 확인 보안 ↑, 성능 ↓
root_squash 서버 원격 루트 권한 제한 보안 ↑

NFS v4.1/v4.2 권장

# NFS v4.2 마운트
$ mount -o nfsvers=4.2 srvr:/export /mountpoint

# 또는
$ mount -o nfsvers=4,minorversion=2 srvr:/export /mountpoint

rsize/wsize 설정

# /etc/fstab
srvr1:/usr/local  /usr/local  nfs  nfsvers=4.2,rsize=131072,wsize=131072  0  0

# systemd automount
srvr1:/usr/local  /usr/local  nfs  noauto,x-systemd.automount,nfsvers=4.2,rsize=131072,wsize=131072  0  0

권장 마운트 옵션

Condition Recommended Options
Server-Side NLM Enabled
mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,rdirplus,readahead=128 server:/path mountpath
Local Locking Enforced
mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,locallocks,rdirplus,readahead=128 server:/path mountpath


Configuration

# NFS 서버 설정
$ sudo systemctl enable nfs-server
$ sudo systemctl start nfs-server

# /etc/exports 설정
$ echo "/srv/nfs4 192.168.1.0/24(rw,sync,no_subtree_check)" | sudo tee -a /etc/exports
$ sudo exportfs -r

# NFS 클라이언트 마운트
$ sudo mount -t nfs -o vers=4.1 192.168.1.10:/srv/nfs4 /mnt/nfs

# /etc/fstab에 추가
$ echo "192.168.1.10:/srv/nfs4 /mnt/nfs nfs nfsvers=4.1,defaults,nofail,timeo=900,retrans=5,_netdev 0 0" | sudo tee -a /etc/fstab


Examples

Example 1: NFS 서버 설정

# NFS 서버 설치
$ sudo apt-get install nfs-kernel-server

# /etc/exports 설정
$ sudo tee /etc/exports << EOF
/srv/nfs4 192.168.1.0/24(rw,sync,no_subtree_check)
EOF

# NFS 서비스 시작
$ sudo systemctl enable nfs-server
$ sudo systemctl start nfs-server

# 공유 내보내기
$ sudo exportfs -r
$ sudo exportfs -v

Example 2: NFS 클라이언트 마운트

# NFS 마운트
$ sudo mount -t nfs -o vers=4.1 192.168.1.10:/srv/nfs4 /mnt/nfs

# 마운트 옵션 확인
$ cat /proc/mounts | grep nfs

# NFS 상태 확인
$ nfsstat -m


Best Practices

  • NFS v4.2 사용 (최신 버전)
  • rsize/wsize=131072 설정 (대용량 전송)
  • nconnect=16 사용 (다중 TCP 연결)
  • MTU 9000 (Jumbo Packet) 적용
  • sync 옵션 사용 (데이터 무결성)
  • root_squash 활성화 (보안)
  • FS-Cache 활성화 (읽기 성능)
  • noatime/nodiratime 설정 (성능)
  • 정기적인 nfsstat 모니터링


Limitations

  • NFSv2: 2GB 파일 제한, UDP만 지원
  • NFSv3: 상태(Stateless) — 서버 재시작 시 세션 손실
  • NFSv4: Kerberos 설정 복잡
  • 네트워크 지연에 민감
  • 대용량 파일 동시 접근 시 병목
  • NFS 서버 단일 장애점 (SPOF)


References


Related Pages

Knowledge Graph

Related

NetworkNFSv4 ACLsStorage

NFSv4.2 Features

NFSv4.2는 NFS 최신 버전. 여러 성능 개선 기능 포함.

PFCP (Parallel NFS)

  • 파일 내 병렬 I/O. 큰 파일 처리 속도↑
  • client-side caching. 로컬 캐시로 읽기 속도↑
# PFCP 마운트 옵션
mount -t nfs4 -o vers=4.2,cache=loose server:/share /mnt/nfs

RDMA-NFS (NFS over RDMA)

  • RDMA로 NFS 트래픽 전송. CPU 부하 ↓, 레이턴시 ↓
  • IPoIB (InfiniBand over IP) 또는 RoCE 사용
# RDMA-NFS 마운트
mount -t nfs -o vers=4.2,rdma server:/share /mnt/nfs

# RDMA-NFS 성능 확인
nfsstat -m

Copy Offload (COPY/DEDUP)

  • 서버 사이드 복사. 네트워크 트래픽 없음
  • 대용량 데이터 이동 시 효율적
# 서버 사이드 복사
cp --reflink=auto /mnt/nfs/source /mnt/nfs/dest