From what I've seen online everyone seems to mount additional EBS drives at /mnt/some_name
. However /mnt
is the mount point of the instance's ephemeral storage and this gets lost when the instance is stopped.
Assuming I've added the right entry in /etc/fstab
can I reboot or stop/start the instance and have the drive still mounted?
My thinking is that the mount point /mnt/some_name
will be lost during the reboot so the drive will not be able to be mounted. Am I right? Where should I mount things then?
Unsatisfied that my question has been understood properly, I've run the experiment for myself. The outcome is that...
Yes, on stop/start everything under /mnt is lost and you can't mount the drive without recreating the mount point. As I expected, but...
If you add an entry to /etc/fstab it doen't matter that the mount point doesn't exist, it will be created and the drive mounted.
sudo mount /dev/xvdf /mnt/test
- Fine.sudo mount /dev/xvdf /mnt/test
- Fine.sudo mount /dev/xvdf /mnt/test
- Error: mount point /mnt/test does not existI haven't tested how deep this autocreation goes. If I mount at /mnt/a/b/c would it still work?
If you have done the entry in /etc/fstab , you dont need to worry. At the time of reboot/restart OS will take care about mounting it to your target directory . You dont need to mount it again. Your data will not be lost in anyway by this. You can run df -kh command to see the mounting status anytime.
/mnt will come back with anything else. Yeah, you'll lose the ephemeral storage if it's not also an EBS LUN, but
1) The new instance should have a /mnt
2) If not, you'll still have your data, which seems to be the only reason I'd want to have it back and
3) Why are you not using EBS as your root too?