Skip to content

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.

Before you begin:

  • A File Store created and in Available status
  • Two or more VMs in the same zone and VPC as the File Store
  • The File Store endpoint IP (from the File Store status)
  • NFS client installed on all VMs
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.

First, verify your File Store is available and get the endpoint IP:

Terminal window
evroc storage filestore get my-filestore

Note the endpoint and exportPath from the output:

status:
nfs:
endpoint: 10.100.0.10
exportPath: /

On each VM that will mount the File Store:

  1. Install NFS client:

    Ubuntu/Debian:

    Terminal window
    sudo apt-get update
    sudo apt-get install -y nfs-common

    RHEL/CentOS/Rocky Linux:

    Terminal window
    sudo yum install -y nfs-utils
  2. Create mount point:

    Terminal window
    sudo mkdir -p /mnt/filestore

Mount the File Store on each VM using the endpoint IP:

Terminal window
# Replace `<filestore-endpoint>` with your File Store endpoint
sudo mount -t nfs4 -o nfsvers=4.1,_netdev <filestore-endpoint>:/ /mnt/filestore

Verify the mount:

Terminal window
df -h | grep filestore

To verify shared access is working:

Create a test file:

Terminal window
echo "Hello from VM-1" | sudo tee /mnt/filestore/shared-test.txt

Read the file:

Terminal window
cat /mnt/filestore/shared-test.txt
# Output: Hello from VM-1

Create another file:

Terminal window
echo "Hello from VM-2" | sudo tee /mnt/filestore/vm2-test.txt

List all files:

Terminal window
ls -la /mnt/filestore/
# Output shows both shared-test.txt and vm2-test.txt

To mount automatically on boot, add entries to /etc/fstab on each VM:

Terminal window
# Replace `<filestore-endpoint>` with your endpoint IP
echo "<filestore-endpoint>:/ /mnt/filestore nfs4 nfsvers=4.1,_netdev 0 0" | sudo tee -a /etc/fstab

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 Store uses standard Linux file permissions. To ensure proper access across VMs:

  1. Use consistent user IDs - Ensure users have the same UID across VMs
  2. Set up groups - Use groups for shared access
  3. Configure ACLs - Use Access Control Lists for fine-grained control

Example: Create a shared group

Terminal window
# 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.

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
  • 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

If mounting works on some VMs but not others:

  1. Check network connectivity:

    Terminal window
    ping <filestore-endpoint>
  2. Verify NFS port is accessible:

    Terminal window
    nc -zv <filestore-endpoint> 2049
  3. Check security group rules allow traffic from the VM

If you see permission errors:

  1. Verify the mount succeeded:

    Terminal window
    mount | grep filestore
  2. Check file permissions:

    Terminal window
    ls -la /mnt/filestore
  3. Ensure users have appropriate permissions

If a VM sees “stale file handle” errors:

  1. Unmount the File Store:

    Terminal window
    sudo umount /mnt/filestore
  2. Remount:

    Terminal window
    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.