2

I am running Ubuntu (12.04.4 LTS) in one of AWS ec2 instance. One of it's mountpoint got nearly full:

$df -h output is similar to this:

/dev/xvdj        50G   45G  2.3G  96% /app

I want to increase its size. But when I go in AWS console, it shows me multiple block devices associated with that EC2 instance (e.g. /dev/sda1, /dev/sdf, /dev/sdg, /dev/sdh etc)

If I click on them it shows me link to EBS ID which after clicking takes me to screen where I can modify that volume size.

Now I have couple of questions here:

  1. How shall I know that which mountpoint is mapped to what EBS ID (So that I will resize correct EBS)
  2. Is it safe to change EBS volume size when Ubuntu is running on that instance?

1 Answer 1

1

Discovering AWS Linux Block Device Mappings

On Amazon Linux I ran this command

aws ec2 describe-volumes

This gave me information about the volumes attached and their mappings, which I have trimmed and slightly obfuscated. Based on the information below you can see /dev/xvda is mapped to vol-0123456, which you can easily look up in the console. If you have multiple volumes you will see multiple attachments.

{
    "Volumes": [
        {
            "Attachments": [
                {
                    "InstanceId": "i-xxxx",
                    "VolumeId": "vol-0123456",
                    "State": "attached",
                    "DeleteOnTermination": false,
                    "Device": "/dev/xvda"
                }
            ],
            "Encrypted": false,
            "VolumeType": "gp2",
            "VolumeId": "vol-0123456",
            "State": "in-use",
            "Iops": 100,
            "SnapshotId": "snap-123123123",
            "Size": 10
        }
    ]
}

Changing Volume Sizes for Running Instances

I have changed the EBS volume size for Windows instances while they were running. However, AWS say on this page that sometimes you will need to stop the instance / detach the volume to modify the size. So, in short, try it and see what happens.

  • In some cases, you must detach the volume or stop the instance for modification to proceed. If you encounter an error message while attempting to modify an EBS volume, or if you are modifying an EBS volume attached to a previous-generation instance type, take one of the following steps:

  • For a non-root volume, detach the volume from the instance, apply the modifications, and then re-attach the volume.

  • For a root (boot) volume, stop the instance, apply the modifications, and then restart the instance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .