Activities

March 2015
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

How to extend Amazon EBS root volume size

I had a situation to increase the EBS root volume of one of my server to felicitate due to storage space requirement. So I simply create EBS AMI of existing server and launch new instance. While I’m creating new EBS AMI, I re-define the new root volume to 50GB. But I could not see this is taking up inside the OS after the launch. The trick is you need to execute “resizefs” command against your EBS device drive.

1. Enter your new storage size while you launch the EBS backed up AMI, See the screen below,
increase_EBS

2. Once you login to the server over ssh you may need to exexute the commandresize2fs < device name> “

Before

[root@OR-Node01 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       15G  7.4G  7.3G  51% /
devtmpfs        279M   12K  279M   1% /dev
tmpfs           297M     0  297M   0% /dev/shm

After

[root@OR-Node01 ~]# resize2fs /dev/xvda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/xvda1 is now 13107200 blocks long.

[root@OR-Node01 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       50G  7.4G   42G  15% /
devtmpfs        279M   12K  279M   1% /dev
tmpfs           297M     0  297M   0% /dev/shm
[root@OR-Node01 ~]#

ebs_extending

That’s it. 🙂

One of the other way is,

1. Stop the running instance
2. Detach the Volume
3. Create a new snapshot of the volume
4. Create a volume from the new create snapshot and mention the size.
5. Attach this volume in to stopped instance as “/dev/sda1” mount point.
6. Login to the server using ssh and execute the command “resize2fs”

Note : I assume this is some kind of complicated thing which may you lead some confusions while doing it. But the fist one is the best and simple approach to address your requirements.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>