Automatically mount an EBS volume upon starting an Amazon EC2 Linux instance

╄→гoц情女王★ 提交于 2019-12-02 14:17:33
Sanket Dangi

Make an entry to /etc/fstab

Entry would be like:

/dev/sdf    /data   ext3    defaults    1 1

This will automatically mount the volume during reboot.

It would seem that the official ec2 documentation now recommends plain old fstab entries with nofail -

/dev/xvdf       /data   ext4    defaults,nofail        0       2

ref - http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Abdelali AHBIB

I recommend using an /etc/init conf file that do that:

  • login with root
  • create a new file (not executable) name it like this : mountec2vol.conf
  • paste into it this code :
# /etc/init/mountec2vol.conf
#
# description: Mounts the EBS Volume
#
start on net-device-up
exec mount /dev/xvdf1 /myVolume`
  • Reboot if you want to test

that's all what you have to do!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!