tech:notes_nfs
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_nfs [2025/10/01 15:54] – Jean-Baptiste | tech:notes_nfs [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes NFS | ||
| + | |||
| + | Voir : | ||
| + | * [[NFS - Exécuter NFSv3 derrière un pare-feu]] | ||
| + | * GPFS | ||
| + | |||
| + | ~~~bash | ||
| + | findmnt --fstab -t nfs | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Serveur | ||
| + | |||
| + | Voir : | ||
| + | * `rclone serv` | ||
| + | |||
| + | |||
| + | Si SNMP | ||
| + | `/ | ||
| + | ~~~ | ||
| + | skipNFSInHostResources 1 | ||
| + | ~~~ | ||
| + | |||
| + | Disable NFS4 delegations | ||
| + | ~~~bash | ||
| + | # On the NFS server | ||
| + | echo 0 > / | ||
| + | sysctl -w fs.leases-enable=0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Client NFS | ||
| + | |||
| + | Mapper un utilisateur - monter le FS pour un utilisateur précis | ||
| + | ~~~ | ||
| + | all_squash, | ||
| + | ~~~ | ||
| + | |||
| + | l' | ||
| + | |||
| + | |||
| + | ### NFS3 | ||
| + | |||
| + | Dans les logs Oracle | ||
| + | ~~~ | ||
| + | WARNING:NFS file system / | ||
| + | WARNING: | ||
| + | WARNING: | ||
| + | WARNING: The directory specified for the diagnostic_dest location has | ||
| + | WARNING: incorrect mount options. [/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | NFSv3 | ||
| + | |||
| + | hard, | ||
| + | |||
| + | rsize/ | ||
| + | |||
| + | |||
| + | NetApp recommended mount options for Oracle single-instance database on Solaris: | ||
| + | rw, | ||
| + | |||
| + | NetApp recommended mount options for Oracle9i RAC on Solaris: | ||
| + | rw, | ||
| + | |||
| + | nas1:/ | ||
| + | nas1:/ | ||
| + | nas1:/ | ||
| + | nas1:/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | NFS4 | ||
| + | ~~~ | ||
| + | el01sn01:/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | NFS performance can come close to FC | ||
| + | |||
| + | Requires | ||
| + | |||
| + | Network topology be clean | ||
| + | |||
| + | no routers, fast switches | ||
| + | |||
| + | Mount options correct : | ||
| + | Rsize / wsize at maximum | ||
| + | * Avoid actimeo=0 and noac | ||
| + | * TCP configuration :MTU 9000 (tricky) | ||
| + | |||
| + | |||
| + | Exemple AWS EFS (NFS) | ||
| + | ~~~bash | ||
| + | yum install -y nfs-utils | ||
| + | sudo mount -t nfs4 -o nfsvers=4.1, | ||
| + | ~~~ | ||
| + | |||
| + | The Amazon EFS client uses the following mount options that are optimized for Amazon EFS: | ||
| + | * _netdev | ||
| + | * nfsvers=4.1 – used when mounting on EC2 Linux instances | ||
| + | * rsize=1048576 | ||
| + | * wsize=1048576 | ||
| + | * hard | ||
| + | * timeo=600 | ||
| + | * retrans=2 | ||
| + | * noresvport | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | #rpm -ql nfs-utils | ||
| + | rpm -q --filesbypkg nfs-utils | grep bin | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | nfs-utils | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Selinux | ||
| + | |||
| + | ~~~bash | ||
| + | #mount -t nfs -o vers=3, | ||
| + | mount -t nfs4 -o context=" | ||
| + | ~~~ | ||
| + | |||
| + | ## Diag | ||
| + | |||
| + | Diag | ||
| + | ~~~bash | ||
| + | tshark -Y ' | ||
| + | ~~~ | ||
| + | |||
| + | ## Pb | ||
| + | |||
| + | |||
| + | ### Pb avec la commande `df` | ||
| + | |||
| + | A la place il est possible d' | ||
| + | |||
| + | ~~~bash | ||
| + | sudo umount -a -t nfs -l | ||
| + | sudo umount -a -t nfs4 -l | ||
| + | sudo umount -a -t autofs -l | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Err access denied by server while mounting | ||
| + | |||
| + | ~~~ | ||
| + | # mount -t nfs 127.0.0.1:/ | ||
| + | mount.nfs: access denied by server while mounting 127.0.0.1:/ | ||
| + | |||
| + | # chmod 1777 / | ||
| + | # chmod 1777 /exports | ||
| + | # mount -t nfs 127.0.0.1:/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Err Read-only file system | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | #specific IP addresses to appear first, IP ranges after. | ||
| + | |||
| + | #/ | ||
| + | #/ | ||
| + | |||
| + | / | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Pb tail latency | ||
| + | |||
| + | How do I use the noac option | ||
| + | |||
| + | Source https:// | ||
| + | |||
| + | |||
| + | #### Problem | ||
| + | |||
| + | A user mounts the same network file system on two ECS servers (ESC-A and ESC-B). The user writes data in append mode on ECS-A, and monitors file content changes with the `tail -f` command on ECS-B. | ||
| + | |||
| + | After data is written on ECS-A, the file content changes on ECS-B may experience latency of up to 30 seconds. | ||
| + | |||
| + | However, if a file is directly opened (such as using `vi`) on ECS-B under the same conditions, the updated content is visible immediately. | ||
| + | |||
| + | |||
| + | #### Analysis | ||
| + | |||
| + | This is related to the mount option and the `tail -f` implementation. | ||
| + | |||
| + | The user uses the following mount command : `mount -t nfs4 /mnt/` | ||
| + | |||
| + | For file systems mounted on ECS-B using the NFS protocol, the kernel maintains a copy of metadata cache for the file and directory attributes. The cached file and directory attributes (including permission, size, and time stamp) are used to reduce the `NFSPROC_GETATTR RPC` requests. | ||
| + | |||
| + | The `tail -f` command uses `sleep+fstat` to monitor changes to the file attributes (primarily the file size), read files, and then output the results. However, file content output by using the `tail -f` command is dependent on the `fstat` result. Due to the metadata cache, the `fstat` command may not be monitoring real-time file attributes. Therefore, even if the file has been updated on the NFS server, the `tail -f` command cannot detect in real time whether the file has been changed or not, resulting in the latency. | ||
| + | |||
| + | |||
| + | #### Solution | ||
| + | |||
| + | Use the `noac` option of the `mount` command to disable the caching of file and directory attributes. The command is as follows: | ||
| + | ~~~bash | ||
| + | mount -t nfs4 -o noac /mnt/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | Cluster multi DC (NFS4 RH8) | ||
| + | ~~~ | ||
| + | rw, sync, noac, actime=0, _netdev | ||
| + | ~~~ | ||
| + | |||
| + | Option exports : `rw, sync` | ||
| + | |||
| + | |||
| + | |||
