Rocky Linux official AWS AMI

@jorp @neil :
Could the Rocky Linux AMI be built without a swap partition? That would allow the storage to be configured seamlessly.

I’m pulling in Rocky Linux 8 (ami-04826709428f49157) and when we log into the console we can see it has been provisioned with 8Gb disk and a 511Mb swap partition.

The problem is that if we provision the image (via Terraform in my case) and specify a larger disk e.g. 15Gb, then the root partition does not automatically get expanded

sh-4.4$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0   15G  0 disk
├─nvme0n1p1 259:1    0  7.5G  0 part /
└─nvme0n1p2 259:2    0  511M  0 part [SWAP]

The reason is the swap partition prevents it. The only way around it requires that the swap partition be deleted so we can run growpart and resize2fs. To delete the partition requires running fdisk, which is a UI and requires human interaction to delete a partition.

In other words, with the existing RockyLinux AMI, if we need a partition larger than 7.5Gb, it requires manual intervention which doesn’t work well with our otherwise-automated pipeline.

The CentOS AMI marketplace doesn’t create a swap partition, I believe for this very reason.

To reproduce: launch a RockyLinux AMI from AWS console, but specify a larger storage size than 8 e.g. 10.
Connect to the console and confirm there is only 7.5Gb available to the root partition.

If you repeat the same exercise but with a CentOS image, you’ll see the root partition is automatically expanded to match the disk size as specified in the launch parameters.

Hi,
we are not getting any swap partition and our disk size is 200GB

[ ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0  200G  0 disk
└─nvme0n1p1 259:1    0  200G  0 part /
[l ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1778         448        1030          18         300        1171
Swap:             0           0           0

We are using below AMI

Its AMI ID is ami-0a10fe11f3e1bf41e and OWNER ID is 792107900819

Thank you @linuxlover : I indeed had the wrong AMI. My filter was “Rocky Linux 8*” in us-east-1 and that picked up an older one, 8.4 from June 2021. Looks like the newer images have since fixed the issue.

And the working one is an 8.5 version (AMI name Rocky-8-ec2-8.5-20211114.2.x86_64)
With the above one there is no longer a swap partition, and resizing from the AWS console works as expected.

1 Like

And for any future readers of this thread wondering about community AMIs owned by 792107900819, this is indeed the Rocky Linux account. To confirm follow the link

This includes a reference to Cloud Images | Rocky Linux. Following the link we see

And picking one of those AMIs shows the RockyLinux owner