Skip to main content

nfs

NFS (Network File System) is a common file sharing protocol in Unix-like systems. You can mount JuiceFS on a Linux server first, and then export the JuiceFS mount point (or its subdirectories) through NFS.

Mount JuiceFS​

Prepare a Linux host as the NFS server, then create and authenticate your JuiceFS file system by following Quick Start.

For Cloud Service / Enterprise Edition, mount by file system name (instead of Community Edition META-URL style):

# Authenticate once (first mount)
juicefs auth $VOL_NAME --token $TOKEN --access-key $ACCESS_KEY --secret-key $SECRET_KEY

# For on-premises deployment, add --console-url
# juicefs auth $VOL_NAME --token $TOKEN --access-key $ACCESS_KEY --secret-key $SECRET_KEY --console-url http://<console-ip>:8080

# Mount JuiceFS for NFS export
sudo juicefs mount $VOL_NAME /mnt/myjfs --update-fstab --sort-dir

For NFS scenarios, --sort-dir is recommended. Some NFS servers (such as nfsd) paginate readdir results, while JuiceFS does not guarantee directory entry order by default. Enabling --sort-dir helps keep directory traversal stable.

Step 1. Install NFS​

Install NFS packages on both server and clients.

Server-side​

# Debian / Ubuntu
sudo apt install -y nfs-kernel-server

# RHEL / CentOS / Rocky / AlmaLinux
sudo yum install -y nfs-utils

Client-side​

# Debian / Ubuntu
sudo apt install -y nfs-common

# RHEL / CentOS / Rocky / AlmaLinux
sudo yum install -y nfs-utils

Step 2. Create exports​

Assume JuiceFS is mounted at /mnt/myjfs, and you want to export /mnt/myjfs/media.

Add this line to /etc/exports:

/etc/exports
"/mnt/myjfs/media" *(rw,sync,no_subtree_check,fsid=1)

NFS export syntax:

<Share Path> <Allowed IPs>(options)

For example, to only allow 192.168.1.0/24 and keep root privileges:

/etc/exports
"/mnt/myjfs/media" 192.168.1.0/24(rw,async,no_subtree_check,no_root_squash,fsid=1)

Apply and start services:

sudo exportfs -rav

# Debian / Ubuntu
sudo systemctl enable --now nfs-kernel-server

# RHEL / CentOS / Rocky / AlmaLinux
sudo systemctl enable --now nfs-server

Verify from client:

# List exported directories
showmount -e <NFS-SERVER-IP>

# Mount from Linux client (example)
sudo mount -t nfs -o vers=4 <NFS-SERVER-IP>:/mnt/myjfs/media /mnt/media

Share option description​

  • rw: Read/write permission. Use ro for read-only.
  • sync and async: sync waits for server confirmation before returning, async returns earlier for better performance.
  • no_subtree_check: Disables subtree checks for better compatibility in many scenarios.
  • no_root_squash: Prevents mapping client root to an unprivileged user. Use carefully due to security risk.
  • fsid: File system identifier in NFS. For NFSv4, use unique IDs for exported file systems.

Choosing between async and sync modes​

sync improves reliability but usually lowers write performance. With JuiceFS, network latency can make this more obvious.

In most JuiceFS + NFS scenarios, async is recommended. If your workload must use sync, consider using high-performance local cache and enabling writeback mode on the JuiceFS client.