Mount a File Store on multiple VMs
File Store is designed for shared access, allowing multiple virtual machines (VMs) to mount the same File Store simultaneously. This guide shows you how to mount a File Store on multiple VMs and configure proper access.
Prerequisites
Before you begin:
- A File Store created and in
Availablestatus - Two or more VMs in the same VPC and zone as the File Store
- The File Store endpoint IP (from the File Store status)
- NFS client installed on all VMs
Architecture
File Store
(10.100.0.10)
|
| VPC Network
______________|______________
| |
VM-1 (10.100.0.5) VM-2 (10.100.0.6)
/mnt/filestore /mnt/filestore
| |
Shared Data Shared Data
All VMs connect to the same File Store endpoint through the VPC network.
Step 1: Verify File Store status
First, verify your File Store is available and get the endpoint IP:
evroc storage filestore get my-filestore
Note the endpoint and exportPath from the output:
status:
nfs:
endpoint: 10.100.0.10
exportPath: /
Step 2: Prepare each VM
On each VM that will mount the File Store:
-
Install NFS client:
Ubuntu/Debian:
sudo apt-get update sudo apt-get install -y nfs-commonRHEL/CentOS/Rocky Linux:
sudo yum install -y nfs-utils -
Create mount point:
sudo mkdir -p /mnt/filestore
Step 3: Mount on each VM
Mount the File Store on each VM using the endpoint IP:
# Replace `<filestore-endpoint>` with your File Store endpoint
sudo mount -t nfs4 -o nfsvers=4.1,_netdev <filestore-endpoint>:/ /mnt/filestore
Verify the mount:
df -h | grep filestore
Step 4: Test shared access
To verify shared access is working:
On VM-1
Create a test file:
echo "Hello from VM-1" | sudo tee /mnt/filestore/shared-test.txt
On VM-2
Read the file:
cat /mnt/filestore/shared-test.txt
# Output: Hello from VM-1
Create another file:
echo "Hello from VM-2" | sudo tee /mnt/filestore/vm2-test.txt
Back on VM-1
List all files:
ls -la /mnt/filestore/
# Output shows both shared-test.txt and vm2-test.txt
Configure automatic mounting
To mount automatically on boot, add entries to /etc/fstab on each VM:
# Replace `<filestore-endpoint>` with your endpoint IP
echo "<filestore-endpoint>:/ /mnt/filestore nfs4 nfsvers=4.1,_netdev 0 0" | sudo tee -a /etc/fstab
Security considerations
Network access
Ensure VMs can reach the File Store endpoint:
- VMs must be in the same VPC as the File Store
- By default, security groups already allow NFS traffic (TCP port 2049) within the same VPC
- Only configure custom security group rules if you have removed default security groups from your VMs
File permissions
File Store uses standard Linux file permissions. To ensure proper access across VMs:
- Use consistent user IDs - Ensure users have the same UID across VMs
- Set up groups - Use groups for shared access
- Configure ACLs - Use Access Control Lists for fine-grained control
Example: Create a shared group
# On each VM, create a group with the same GID
sudo groupadd -g 2000 sharedusers
# Add users to the group
sudo usermod -aG sharedusers username
# Set group ownership on files
sudo chown -R :sharedusers /mnt/filestore/shared-directory
sudo chmod 2775 /mnt/filestore/shared-directory
The 2775 permission sets the setgid bit, ensuring new files inherit the group.
Performance considerations
When multiple VMs access the same File Store:
- Total throughput is shared across all mounts
- Concurrent access to the same files may impact performance
- Caching on each VM may cause temporary inconsistencies
Best practices
- Distribute read-heavy workloads across multiple File Stores
- Avoid having multiple VMs write to the same file simultaneously
- Use application-level locking if coordinating access
- Consider separate File Stores for different workload types
Troubleshooting
Mount fails on some VMs
If mounting works on some VMs but not others:
-
Check network connectivity:
ping <filestore-endpoint> -
Verify NFS port is accessible:
nc -zv <filestore-endpoint> 2049 -
Check security group rules allow traffic from the VM
Permission denied errors
If you see permission errors:
-
Verify the mount succeeded:
mount | grep filestore -
Check file permissions:
ls -la /mnt/filestore -
Ensure users have appropriate permissions
Stale file handle errors
If a VM sees "stale file handle" errors:
-
Unmount the File Store:
sudo umount /mnt/filestore -
Remount:
sudo mount -t nfs4 -o nfsvers=4.1,_netdev <endpoint>:/ /mnt/filestore
This can happen if the File Store recovers after a failure while a VM had files open.
See Also
- Configure mount options - Optimize mount settings
- Configure security groups - Control network access
- Troubleshooting - Common issues and solutions