Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

share|improve this answer
    
"take care about mounting it to your target directory" - but what if that target dir doesn't exist anymore? It won't be able to mount there. –  Jake Aug 25 '12 at 8:13

/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?

share|improve this answer
    
It's not /mnt I'm worried about, everything under it is lost so the mount point /mnt/some_name doesn't exist and the disk can't be mounted there. –  Jake Aug 25 '12 at 8:15
    
I'm not just worried about the data either, I want to know that services that require access to /mnt/some_name can start automatically after reboot. –  Jake Aug 25 '12 at 8:16
    
I am using EBS as my root, but /mnt/ is ephemeral instance storage. –  Jake Aug 25 '12 at 8:17
up vote 0 down vote accepted

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.

  • Create new small instance, an extra EBS and a filesystem on it.
  • Create a directory at /mnt/test, inside the ephemeral storage.
  • sudo mount /dev/xvdf /mnt/test - Fine.
  • Reboot
  • /mnt/test exists.
  • sudo mount /dev/xvdf /mnt/test - Fine.
  • Stop Instance
  • Start Instance
  • /mnt/test does not exist
  • sudo mount /dev/xvdf /mnt/test - Error: mount point /mnt/test does not exist
  • Recreate dir, remount drive, add to /etc/fstab
  • Stop Instance
  • Start Instance
  • /mnt/test exists, EBS mounted, testfile exists

I haven't tested how deep this autocreation goes. If I mount at /mnt/a/b/c would it still work?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.