Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up a database server on EC2, and I need to ensure that an EBS volume is automatically attached and is available before the database service starts up.

I'm using SMF so I can test whether a particular filesystem is available before starting the db service, so there's no problem from that perspective, however I'm not quite sure how to tell the server to auto-attach the EBS volume during/after boot.

What would be the best strategy for this?

share|improve this question

You just need a couple of short scripts -one to attach the EBS volume at boot time and the other to detach it on shutdown to make sure the shutdown is clean. See this AWS forum post.

share|improve this answer

You can use the -b flag of the ec2-run-instances or ec2-register commands to automatically create a volume from a snapshot and attach it at a specific block device location or create an empty volume. Ex:

ec2-run-instances [OPTIONS] AMI [AMI-OPTIONS] -b /dev/sda2=snap-1234abcd:50

where snap-1234abcd is the snapshot id, 50 is the size of the volume to be created. Either one is sufficient.

share|improve this answer

Your Answer


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.