How to Attach an Amazon EBS Volume to a Linux Instance

How to Attach an Amazon EBS Volume to a Linux Instance

The Amazon Elastic Block Store (Amazon EBS) offers disks storage for the Amazon EC2 instances. Amazon EBS volumes provide a scalable storage service, which persists independently of the instance life.

    • It is mandatory that both the volume as well as the instance be in the same availability zone.
    • The user can create a volume and assign a maximum of 16 EBS volumes to an instance.

The present guide demonstrates how attach an EBS volume to an instance.

1. Enter the AWS user interface console and select the EC2 service. From the EC2 dashboard, click on the Running Instances or the Instance link.

2. Select the running instance. In the instance information click on the block device name. Learn how to read Amazon EC2 instance metadate. As shown below the current instance has only one block device.


[Newvem continuously tracks and analyzes complete resources utilization patterns, and provides a down-to-the-hour picture of your AWS consumption and usage behavior, as well as future capacity estimates Learn More]


3. Go to Volumes and check the attached volume details.

4. Create an additional volume in the same zone where the instance is running.

5. Select the volume to be attached. From the “Action” menu, select “Attach Volume”.

6. AWS console dialog will ask for the instance, where the EBS volume will be attached. The device name should also be provided.  The block device driver for the instance assigns the actual volume names when mounting the volumes. Click on “Yes, Attach”.

7. Once the volume attached to the instance, the EC2 instance information will be displayed in the volume attachment information.

8. When the user checks the instance information, as explained in step#2, it will display the two devices. The newly attached device is shown as “sdf”.

9. Clicking the sdf EBS volume device, displays the device information.

10. For Linux, the volume when attached may not be available as an additional disk until it is mounted to the directory. Login to the instance. Run the command “df -h”, which lists all the devices mounted and the size of the device. Currently the new device on sdf has not been mounted. Thus, it will not be displayed.

11. Run the command “fdisk –l”, which lists all the devices attached to the instance. The newly attached device on /dev/sdf will be shown as /dev/xvdf due to the AWS internal device driver management.

12. First format the newly attached device with the command “mkfs.ext3 /dev/sdf”. The user can use a different format command based on the file system requirement.

13. Now create a directory in the instance with the mkdir command.

14. Mount the formatted device to the directory with the command “mount < device location> <directory location>”.

15. When the user runs the command df –h, the newly mounted device (volume) will be displayed.

16. The actual output of the above mentioned commands is shown below:


[Newvem analytics tracks your AWS cloud utilization:

  • Hourly Utilization Pattern Analysis 
  • Reserved Instances Decision Tool 
  • Resource Resizing Opportunities

Create Your Free Account or Learn More]


Keywords: Amazon web services, Amazon AWS console, EC2 Service, EC2 Instance, Amazon cloud computing, Amazon EBS, EBS Volume, Linux Instance, Elastic Block Store,

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations