I have an EBS volume (e.g. /dev/sdf
) that has been attached to an EC2 instance (which boots from a different EBS volume), and I have mounted the volume (through mount /dev/sdf /data
). When I stop and start again the instance, the volume is still attached but no longer mounted, and I have to manually mount it again.
Is there a way to make the volume /dev/sdf
automatically mounted to /data
upon starting the instance?
To attach an Amazon EBS volume to a running instance, and then make the volume available to Windows, follow these steps: Attach the Amazon EBS volume to the Amazon EC2 Windows instance. You can use the Amazon EC2 console, the AWS Command Line Interface (AWS CLI), or AWS Tools for Windows PowerShell.
You can't attach instance store volumes to an instance after you've launched it. If you change the instance type, an instance store will not be attached to the new instance type.
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Instances. Select the instance. In the Description tab, for Block devices, select the block device mapping and then choose the EBS ID to view additional details for the volume.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With