How to extend AWS EBS volumes with no downtime
How to extend AWS EBS volumes with no downtime
If you need to extend your EBS volume With No Downtime, please follow these simple steps:
- Login to your AWS console
- Choose “EC2” from the services list
- Click on “Volumes” under ELASTIC BLOCK STORE menu.
- Choose the volume that you want to resize, right click on it and click “Modify Volume”
Set the new size for your EBS volume (in this case i have extended an 8GB volume to 50GB)
- Click on modify.
Now, we need to extend the partition itself.
- SSH to the EC2 instance where the EBS volume is attached.
- Type the following command to list our block devices:
[root@awsserver ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 50G 0 disk
└─xvda1 202:1 0 8G 0 part /
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 50G 0 disk
└─xvda1 202:1 0 8G 0 part /
- As you can See root Device is showing 50GB but the partition is showing 8GB. Now Grow the partition.
[root@awsserver ~]# growpart /dev/xvda 1
CHANGED: partition=1 start=2048 old: size=16775168 end=16777216 new: size=104855519,end=104857567
CHANGED: partition=1 start=2048 old: size=16775168 end=16777216 new: size=104855519,end=104857567
- We have a XFS filesystem so ran , xfs_growfs
[root@awsserver ~]# xfs_growfs /
meta-data=/dev/xvda1 isize=512 agcount=4, agsize=524224 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=2096896, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2096896 to 13106939
[root@awsserver ~]#
meta-data=/dev/xvda1 isize=512 agcount=4, agsize=524224 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=2096896, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2096896 to 13106939
[root@awsserver ~]#
- Now Check the File System Size :
[centos@awsserver ~]$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 50G 12G 39G 23% /
[centos@awsserver ~]$
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 50G 12G 39G 23% /
[centos@awsserver ~]$
You have just extended your EBS volume size.
No comments