We have a EBS io2 Volume with Multi-Attach enabled that we are attaching and mounting to 2 different EC2 instances, but it only shows the files on the 2nd instance that were available at the point when the volume is mounted but does not show any changes being made to them on the 1st instance. We need to restart the instance and mount the volume again to see the new ones again.
That is not much useful when we want to even just check the files or see any changes on the drive.
We have the auto mounting on instance start setup in the fstab
file with the following command
UUID=<my-ebs-volume-uuid> /shared xfs defaults,nofail 0 2
We also auto mount another EFS volume using the following command in fstab
file, which works fine and also reflects the changes on both the instances
<my-efs-id>.efs.eu-central-1.amazonaws.com:/ /efs nfs4 defaults,_netdev 0 0
Does anyone have an idea what we might be doing wrong for the multi-attach EBS volume?
Per the EBS Multi-Attach documentation:
Standard file systems, such as XFS and EXT4, are not designed to be accessed simultaneously by multiple servers, such as EC2 instances. You should use a clustered file system to ensure data resiliency and reliability for your production workloads.
In other words, the file system you are using was designed for only one servers to be accessing it at a time. When you have two or more servers accessing the file system, the file system needs to notify all servers of any updates to the file system. Here's an AWS blog post with more details.