Question
How can I resize the HVR volume with AWS HVR AMI?
Environment
AWS AMI for Hub
Answer
When the Hub AWS EC2 instance that's built with HVR AMI is running out of disk space for /opt/hvr, you may need to increase the volume size.
Follow this AWS document to increase the EBS volume used for HVR AMI Hub.
- Go to AWS.
- Click on the EC2instance.
- Choose Storage and select this volume. Select action/modify volume to increase the size.
For example: change it from 80 GB to 100 GB. - Wait until the status for the volume changes to Okay.
- Login to the EC2 instance machine to increase the logical volume LVR per AWS document.
For example: The HVR volume shows up as /dev/xvdb in AWS.
[ec2-user@ip-xxx ~]$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 988M 0 988M 0% /dev
tmpfs tmpfs 996M 0 996M 0% /dev/shm
tmpfs tmpfs 996M 436K 995M 1% /run
tmpfs tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/xvda1 xfs 10G 3.4G 6.7G 34% /
tmpfs tmpfs 996M 4.0K 996M 1% /tmp
/dev/mapper/hvr_vg-hvr_lv ext4 79G 361M 75G 1% /opt/hvr
tmpfs tmpfs 200M 0 200M 0% /run/user/1000
[ec2-user@ip-xxx ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
└─xvda1 202:1 0 10G 0 part /
xvdb 202:16 0 100G 0 disk
└─hvr_vg-hvr_lv 253:0 0 80G 0 lvm /opt/hvr
If you use resize2fs command for ext4
[ec2-user@xxx ~]$ sudo resize2fs /dev/xvdb
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Device or resource busy while trying to open /dev/xvdb
Couldn't find valid filesystem superblock.
This is because HVR volume is created with LVR. You can follow the instructions in the below document to change the size of LVR volumes.
https://aws.amazon.com/premiumsupport/knowledge-center/create-lv-on-ebs-volume/
Below are the steps
[ec2-user@ip-xxx run]$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sdb hvr_vg lvm2 a-- <80.00g 0
[ec2-user@ip-172-31-23-160:A871477 run]$ sudo pvresize /dev/sdb
Physical volume "/dev/sdb" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
[ec2-user@ip-xxx run]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 988M 0 988M 0% /dev
tmpfs 996M 0 996M 0% /dev/shm
tmpfs 996M 436K 995M 1% /run
tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/xvda1 10G 3.4G 6.7G 34% /
tmpfs 996M 0 996M 0% /tmp
/dev/mapper/hvr_vg-hvr_lv 79G 361M 75G 1% /opt/hvr
tmpfs 200M 0 200M 0% /run/user/1000
[ec2-user@ip-xxx run]$ sudo lvextend -r -l +100%FREE /dev/mapper/hvr_vg-hvr_lv
Size of logical volume hvr_vg/hvr_lv changed from <80.00 GiB (20479 extents) to <100.00 GiB (25599 extents).
Logical volume hvr_vg/hvr_lv successfully resized.
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/hvr_vg-hvr_lv is mounted on /opt/hvr; on-line resizing required
old_desc_blocks = 10, new_desc_blocks = 13
The filesystem on /dev/mapper/hvr_vg-hvr_lv is now 26213376 blocks long.
Now it shows the size increased from 80gb to 100gb for /opt/hvr
[ec2-user@ip-xxx run]$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 988M 0 988M 0% /dev
tmpfs tmpfs 996M 0 996M 0% /dev/shm
tmpfs tmpfs 996M 436K 995M 1% /run
tmpfs tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/xvda1 xfs 10G 3.4G 6.7G 34% /
tmpfs tmpfs 996M 0 996M 0% /tmp
/dev/mapper/hvr_vg-hvr_lv ext4 99G 365M 94G 1% /opt/hvr
tmpfs tmpfs 200M 0 200M 0% /run/user/1000
Cause
Hub HVR volume is running out of disk space