AWS Add new disk volume
The procedure of add new 1 GB disk volume for AWS EC2.
Procudure:
a.) Login to AWS console and, modify ec2 disk volume.
b) Access EC2 by ssh
c.) Check the partition block and file system
d.) expand the partition block
e.) expand the file system
0. Check the petition size.
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 482M 0 482M 0% /dev
tmpfs 492M 0 492M 0% /dev/shm
tmpfs 492M 560K 492M 1% /run
tmpfs 492M 0 492M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 7.3G 775M 91% /
tmpfs 99M 0 99M 0% /run/user/0
tmpfs 99M 0 99M 0% /run/user/1000
1. Login to AWS console and select "volume"
2. Select exit volume and select “Modify Volume”
3. Change Size and push “Modify” buton
4. Read the message and push “Yes”.
5. Close the box.
6. Check the disk volume again. but the disk volume had not been expanded.
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 482M 0 482M 0% /dev
tmpfs 492M 0 492M 0% /dev/shm
tmpfs 492M 504K 492M 1% /run
tmpfs 492M 0 492M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 7.3G 775M 91% /
tmpfs 99M 0 99M 0% /run/user/1000
7. Check the file system. mail partition /dev/xvda1 file system is ‘xfs’.
# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 482M 0 482M 0% /dev
tmpfs tmpfs 492M 0 492M 0% /dev/shm
tmpfs tmpfs 492M 504K 492M 1% /run
tmpfs tmpfs 492M 0 492M 0% /sys/fs/cgroup
/dev/xvda1 xfs 8.0G 7.3G 775M 91% /
tmpfs tmpfs 99M 0 99M 0% /run/user/1000
8. List block device and expand volume
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 9G 0 disk
mqxvda1 202:1 0 8G 0 part /
# growpart /dev/xvda 1
CHANGED: partition=1 start=4096 old: size=16773087 end=16777183 new: size=18870239 end=18874335
9. Check the volume of the block
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 9G 0 disk
mqxvda1 202:1 0 9G 0 part
10. Check the file system
Check by df command and it found the partition /dev/xvda1 file system is ‘xfs’.
# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 482M 0 482M 0% /dev
tmpfs tmpfs 492M 0 492M 0% /dev/shm
tmpfs tmpfs 492M 504K 492M 1% /run
tmpfs tmpfs 492M 0 492M 0% /sys/fs/cgroup
/dev/xvda1 xfs 8.0G 7.3G 775M 91% /
tmpfs tmpfs 99M 0 99M 0% /run/user/1000
11. expand xfs file system
# xfs_growfs -d /
meta-data=/dev/xvda1 isize=512 agcount=4, agsize=524159 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1 spinodes=0
data = bsize=4096 blocks=2096635, 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 2096635 to 2358779
* if file system is ext4, please use resize2fs command.
The /dev/xvda1 size is expanded to 9.0GB
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 482M 0 482M 0% /dev
tmpfs 492M 0 492M 0% /dev/shm
tmpfs 492M 512K 492M 1% /run
tmpfs 492M 0 492M 0% /sys/fs/cgroup
/dev/xvda1 9.0G 7.3G 1.8G 81% /
tmpfs 99M 0 99M 0% /run/user/1000