After you upgrade your storage, you will need to expand the partition. Sometimes there is a need to create a separate partition which would not be possible if we auto-expanded the primary partition to fill the newly available space.
We made a simple tool to make expanding the volume as easy as possible. It's a simple script that runs a series of commands (the exact steps are outlined below for your convenience).
sudo /var/lib/cloud/scripts/per-instance/ps_resize.sh
The script runs:
#!/bin/sh
root_vg_name=sudo lvs --noheadings | grep root | awk '{print $2}'
parted /dev/xvda resizepart 2 100%
parted /dev/xvda resizepart 5 100%
pvresize /dev/xvda5
lvextend /dev/$root_vg_name/root -r -l 100%VG
exit 0