Some Fedora 39 aarch64 images won’t fit on small SD cards (Minimal > 4 GB, Workstation > 16 GB)

Problem

Fedora 39 Minimal won’t fit onto a 4 GB storage device and Fedora 39 Workstation won’t fit onto a 16 GB storage device, even though they are expected to do so.

Cause

Fedora images got gradually larger in the last few years, we failed to notice and the images are larger than expected.

Related Issues

Bugzilla report: #2247611

Workarounds

Option A) Use a larger storage device

Finding a larger storage device is often the easy solution.
For Minimal, at least 8 GB storage device is needed.
For Workstation, at least 32 GB storage device is needed.

Option B) Shrink the official disk image

It is possible to shrink the official disk image to a smaller size. This can be only performed with the Workstation disk image, to make it fit a 16 GB storage device. For Minimal, the contents is too large and can’t fit 4 GB storage.

Warning: This might be dangerous and can corrupt the filesystem of the shrunk image, if the resize operations don’t go as planned. We can’t guarantee reliability of the following instructions.

  1. Decompress the downloaded file:
unxz -kv Fedora-Workstation-39-1.5.aarch64.raw.xz
  1. Attach the image to a loopback device. This will create a new device in /dev, such as /dev/loop0 (we will assume this name). You’ll be able to treat the image as any other disk:
sudo losetup -P -f Fedora-Workstation-39-1.5.aarch64.raw
  1. Using GNOME Disks or GParted, find the new device (its partitions will reference the /dev/loop0 device). Shrink the third partition (/dev/loop0p3) to 10 GB. After the operation is complete, make sure the partition is unmounted.

  2. Detach the image from loop device:

sudo losetup -d /dev/loop0
  1. Create a new 14 GB image disk (the number is intentionally lower, to make sure it fits to any “16 GB” storage) based on your adjusted Workstation image. The third partition will get automatically expanded to fill all extra space.
sudo dnf install guestfs-tools
truncate -s 14G F39-smaller.raw
virt-resize --expand /dev/sda3 Fedora-Workstation-39-1.5.aarch64.raw F39-smaller.raw
  1. Compress the image, because arm-image-installer expects xz-compressed image:
xz -k -v -0 -T0 F39-smaller.raw
  1. You can now use arm-image-installer with your new F39-smaller.raw.xz. It should fit to your 16 GB storage device.

You can discuss this issue here.