Search My Blog

Saturday, December 11, 2021

How to change/resize the LVM Volumes on a STIG-Partitioned Enterprise Linux (spel) AMI Image

Many organizations / projects seem to use the SPEL Linux project's images ( as a starting point for their OS deployments. Unfortunately, many IT folks starting with these don't know how to resize the LVM volumes and end up just attaching new EBS volumes and moving mount points around. The base SPEL Linux image is only 20GB.

The SPEL folks have a README on how to resize with Cloudinit:

Here is an alternative way - I won't say this is the "best" way to automate this resizing. But it is straight forward, not error prone, and repeatable on NITRO-based AWS EC2 Instances (i.e. C5/C5d/C5n, M5/M5d/M5n/M5dn, R5/R5d/R5n/R5dn, T3, and P3dn ). This should result in a pleasant experience for folks that are not comfortable resizing by-hand the volumes or messing with Cloudinit.

Enjoy the below:

# Usage:

Just add this text/script to the USERDATA section of the Launch AMI process. This field is located at the bottom of the Step 3: Configure Instance Details when  launching an AMI.

On Step 4: Add Storage - Set the base EBS size to 100GB (base image default is 20GB). OPTIONAL: Change Volume Type to gp3 (they are better), default is gp2. If you don't want a 100GB volume, change to smaller or larger, but adjust values as appropriate below in the partition code.

Let the machine launch, wait about 5 min, login, and should be all configured with new volume sizes.