On this page
NFS file shares
An NFS file share is a shared file system that many instances can mount and use at the same time, so a fleet of servers reads and writes the same files over the network.
Where a block volume attaches to a single instance, a file share is built for concurrent access. Mount it on several web servers, application nodes or workers and they all see the same directory tree, which is ideal for shared uploads, content, configuration and build artifacts.
You control who can mount a share with access rules, and you place shares on your private network through a share network so only your instances can reach them. Shares can be resized as your data grows.
Key concepts
Share — A shared file system exported over NFS that multiple instances can mount at once.
Share network — The private network a share is attached to so your instances can reach it.
Access rule — A grant that permits a client (by IP) to mount the share, read-only or read-write.
Export path — The address and path you mount, shown on the share's detail page.
Before you start
- A private network to attach the share to (a share network).
- One or more instances on that network to mount the share.
- Enough file-share quota in the project.
- The
nfs-commonclient package installed on each instance.
Step by step
- Create a share
Go to Storage > NFS shares and choose Create share; set a name, a size and the share network to place it on.
Screenshot — The Create share form with the size and share-network fieldsThe Create share form with the size and share-network fields - Wait until it is available
The share becomes ready within a short time and gets an export path you will mount.
- Grant access
Open the share and add an access rule for each client IP that should mount it, choosing read-only or read-write.
Screenshot — The access-rules panel with a rule granting an instance read-write accessThe access-rules panel with a rule granting an instance read-write access - Find the export path
Copy the export path from the share's detail page; it is what you pass to the mount command.
Screenshot — The share detail page showing the export pathThe share detail page showing the export path - Mount it on your instances
- Install the NFS client if needed.
- Create a mount point and mount the export path.
- Add it to
/etc/fstabto remount on reboot.
Examples
sudo apt-get install -y nfs-common sudo mkdir -p /mnt/shared # use the export path shown on the share detail page sudo mount -t nfs <export-path> /mnt/shared
<export-path> /mnt/shared nfs defaults,_netdev,nofail 0 0
Limits & specifications
Actions available on a file share:
| Action | What it does |
|---|---|
Create | Provision a new share on a share network. |
Add access rule | Allow a client IP to mount, read-only or read-write. |
Resize | Grow the share's capacity. |
Delete | Remove the share and its data. |
Best practices
- Grant the narrowest access that works: read-only where writes are not needed.
- Restrict access rules to specific instance IPs rather than broad ranges.
- Use
_netdevandnofailin/etc/fstabso a share that is briefly unreachable does not hang the boot. - Place shares on the same private network as the instances that mount them.
- Do not use a file share as a database's data directory; use a block volume for that.
FAQ
How many instances can mount one share?
My mount command times out.
Can I make a share bigger later?
Is a file share the same as object storage?
Learn more
Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.