3

So I'm trying to use AWS EFS with EC2 to have persistent storage between multiple instances.

I'm mounting the drive using, sudo mount -t nfs4 -o nfsvers=4.1 $(curl -s http://IPADDRESSHERE/latest/meta-data/placement/availability-zone).FILESYSTEMIDHERE.ZONEHERE.amazonaws.com:/ /mydir. I have replaced some of the key information with placeholders for security reasons.

After running that nothing happens it just goes right back to the terminal no success message and no error message so I assume it worked.

I create a folder or file inside /mydir and ls /mydir and everything shows up fine.

Then I unmount the drive using sudo umount /mydir. Once again after running that no error but no success message so I assume it worked. All the files stay in the folder and nothing changes after running that.

Then I create a new directory and mount the drive to that new directory and none of the files or folders I created show up in that new folder.

So it looks like it's not even saving to the EFS drive if when mounting to a new folder it doesn't even sync down the files. Any ideas on how to get this working? Thanks so much in advance.

Charlie Fish
  • 217
  • 2
  • 9
  • Are you inside of /mydir when mounting? Any interesting logs in "dmesg"? – EEAA Jul 12 '16 at 00:47
  • @EEAA Yes I am inside of /mydir when mounting. I have uploaded the result of "dmesg" here, http://pastebin.com/ZtauTKKe – Charlie Fish Jul 12 '16 at 00:51
  • That is likely the problem. Try staying in the parent of /mydir to mount, then cd into /mydir. – EEAA Jul 12 '16 at 00:51
  • @EEAA Oh wow looks like that worked. One last question that is totally unrelated. Does mounting an EFS drive take up the local storage on EBS? And if so does un-mounting that EFS drive free that storage? Also feel free to submit that as an answer if you would like and I will accept it and up vote it. Thanks so much for your help!! – Charlie Fish Jul 12 '16 at 00:55

1 Answers1

6

To your original question: if you mount a filesystem "on top" of your current working directory, you will not see the contents of the mounted fs, nor will you be able to save content to that fs until you cd back to the parent directory and then enter the mounted fs again.

When you write data, it consumes space on whatever filesystem it is written to. In the case of EFS, data saved there will not affect usage of your EBS volumes.

EEAA
  • 109,363
  • 18
  • 175
  • 245