skip to Main Content

Add EBS to Ubuntu EC2 Instance

source: http://stackoverflow.com/questions/11535617/add-ebs-to-ubuntu-ec2-instance
additional info: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html

Since this is a new volume, you need to format the EBS volume (block device) with a file system between step 1 and step 2. So the entire process with your sample mount point is:

Create EBS volume.

Attach EBS volume to /dev/sdf (EC2’s external name for this particular device number).

Format file system /dev/xvdf (Ubuntu’s internal name for this particular device number):

sudo mkfs.ext4 /dev/xvdf
Only format the file system if this is a new volume with no data on it. Formatting will make it difficult or impossible to retrieve any data that was on this volume previously.

Mount file system (with update to /etc/fstab so it stays mounted on reboot):

sudo mkdir -m 000 /vol
#echo “/dev/xvdf /vol auto noatime 0 0” | sudo tee -a /etc/fstab
echo “/dev/xvdf /vol auto noatime 0 0” >> /etc/fstab
sudo mount /vol

Just to be explicit, /dev/xvdf doesn’t exist prior to your mounting /dev/sdf

Leave a Reply

Back To Top