We started migrating from Amazon Linux 2 (AL2) to Amazon Linux 2023 (AL2023) a month ago. While testing workloads on AL2023 in the pre-production environment, I noticed slightly higher disk utilization compared to the same workload on AL2. In this post, I'll share my investigation.
Although disk utilization metrics increased on AL2023, the "Used" space remained the same. The higher utilization is due to a decrease in the total ext4 filesystem size. The table below compares sizes of ext4 formatted EBS volumes.
For example, on a 128GiB EBS volume, the free space decreased by 0.7%, from 125.8GiB to 124.9 GiB. You can reproduce this behavior using the steps below.
It appears the filesystem uses more space for metadata on AL2023 than on AL2. Metadata accounting is tricky and filesystem behavior as free space is exhausted is complicated, so I wanted to confirm if the writable space for applications is genuinely reduced. Using the script below, I created 50 MiB files until no space was left.
Since the last 50MiB file was written partially, "Used space" is larger than the "Total size of files". The difference in used space between AL2 and AL2023 is 896 MiB, matching the filesystem size difference. Thus, applications indeed have less writable disk space on AL2023 when using ext4.