Add EBS to Ubuntu EC2 Instance

0 votes

I'm having problem connecting EBS volume to my Ubuntu EC2 Instance.

Here's what I did:

  1. From the Amazon AWS Console, I created a EBS 150GB volume and attached it to an Ubuntu 11.10 EC2 instance. Under the EBS volume properties, "Attachment" shows: "[my Ubuntu instance id]:/dev/sdf (attached)"

  2. Tried mounting the drive on the Ubuntu box, and it told me "mount: /dev/sdf is not a block device"

    sudo mount /dev/sdf /vol

  3. So I checked with fdisk and tried to mount from the new location and it told me it wasn't the right file system.

    sudo fdisk -l

    sudo mount -v -t ext4 /dev/xvdf /vol

    the error:

    mount: wrong fs type, bad option, bad superblock on /dev/xvdf, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so

    "dmesg | tail" told me it gave the following error:

    EXT4-fs (sda1): VFS: Can't find ext4 filesystem

I also tried putting the configurations into /etc/fstab file as instructed on http://www.webmastersessions.com/how-to-attach-ebs-volume-to-amazon-ec2-instance, but still gave same not the right file system error.

Questions:

Q1: Based on point 1 (above), why was the volume mapped to 'dev/sdf' when it's really mapped to '/dev/xvdf'?

Q2: What else do I need to do to get the EBS volume loaded? I thought it'll just take care of everything for me when I attach it to a instance

May 16, 2019 in AWS by shubham
• 7,340 points
1,143 views

1 answer to this question.

0 votes

you are creating a new volume, so are supposed to format the EBS volume with a file system after your step 1. Try this, entire process with your sample mount point is: 

  1. Create EBS volume.

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

  3. Format file system /dev/xvdf (Ubuntu's internal name for this particular device number): sudo mkfs.ext4 /dev/xvdf

Note:- You should format a file system only if it is a new volume with no data. After Formatting it is very difficult or impossible to any data that was on this volume previously.

4. 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 

 sudo mount /vol

I hope this helps you:) 

answered May 16, 2019 by ArchanaNagur
• 2,360 points

Related Questions In AWS

0 votes
3 answers
0 votes
1 answer

How to add swap to Amazon EC2 instance?

A fix for this problem is to ...READ MORE

answered Sep 11, 2018 in AWS by Archana
• 4,170 points
637 views
0 votes
1 answer

What is the porcess to add swap to an EC2 Instance?

If you are finding problem with your ...READ MORE

answered Mar 27, 2019 in AWS by Himanshu
530 views
0 votes
0 answers
0 votes
1 answer

How to reset EC2 ubuntu instance?

AWS doesn't have a feature like VmWare's ...READ MORE

answered Feb 23, 2022 in AWS by Korak
• 5,820 points
4,575 views
0 votes
0 answers

AWS Opsworks failed to add EC2 instance

I made a new EC2 instance and ...READ MORE

Apr 25, 2022 in AWS by Soham
• 9,710 points
499 views
0 votes
1 answer

Adding Keypair to existing EC2 instance

No you can't. The reason is KeyPair ...READ MORE

answered Apr 8, 2018 in AWS by code_ninja
• 6,300 points
1,330 views
0 votes
1 answer
0 votes
1 answer

Does it make sense to have an Amazon Elastic Load Balancer with just one EC2 instance?

Well you are right Elastic Load Balancer is mainly ...READ MORE

answered Mar 20, 2019 in AWS by ArchanaNagur
• 2,360 points
693 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP