Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add EBS to Ubuntu EC2 Instance

People also ask

How do I add EBS to EC2 instance?

To attach an EBS volume to an instance using the consoleOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Elastic Block Store, Volumes. Select an available volume and choose Actions, Attach Volume. For Instance, start typing the name or ID of the instance.

How do I add more storage to EC2 instance?

In Step 1: Choose an Amazon Machine Image (AMI), select the AMI to use and choose Select. Follow the wizard to complete Step 1: Choose an Amazon Machine Image (AMI), Step 2: Choose an Instance Type, and Step 3: Configure Instance Details. In Step 4: Add Storage, modify the existing entries as needed.

How do you mount EBS?

To mount an attached EBS volume on every system reboot, add an entry for the device to the /etc/fstab file. You can use the device name, such as /dev/xvdf , in /etc/fstab , but we recommend using the device's 128-bit universally unique identifier (UUID) instead.

Where is EBS attached to EC2?

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.


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:

  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
    

    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.

  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