Because it's LVM the Logical Volume can be extended by simply adding more disks (Physical Volumes = EBS volumes) to the Volume Group.
- Create an AMI from your current server so you've got a way back if things go wrong.
- Create 3 new EBS volumes (e.g. 3x 50GB)
- Create LVM partition on each of them and
pvcreate
the partition
- Add the volumes to Volume Group using
vgextend
- Extend the MySQL Logical volume with
lvresize
and then extend the filesystem (depends on your fs type, e.g. resize2fs
).
- Done.
You can try to expand the current EBS volumes instead of adding 3 new ones but then you'll still have to expand all the partitions, update the VG, expand the LV and resize the filesystem. It's a little more prone to a mistake but should work the same.
The benefit of using multiple EBS volumes is that IOPS bandwidth is per-volume. I.e. more volumes give you more IO bandwidth. It may not be relevant if your MySQL server is only lightly loaded but still good to know.
Or use Amazon Aurora instead
If I were you I would migrate your database to Amazon Aurora which is a MySQL-compatible managed database. There is virtually no need to run self-managed MySQL on EC2 unless you do something very very special. With Aurora you'll get:
- Automatic disk space management (no more running out of space, no more managing EBS volumes)
- Automatic OS and MySQL patching
- Automatic fail-over in case of underlying physical host failure (how do you handle that on your current instance?)
- Automatic backups with point-in-time recovery (great if you accidentally
TRUNCATE wrong_table_oops;
;)
- All that while providing nearly 100% compatibility with stock standard MySQL
I have migrated many MySQL databases to Aurora and in almost all cases it was as simple as mysqldump
from the old database and load that into Aurora (alternatively use AWS DMS) and change the database host name in the application. Simple as that and will save you lots of MySQL management overhead going forward.
Hope that helps :)