hyperreal.coffee

Install Fedora on RockPro64 with boot on eMMC and rootfs on SSD

This guide goes through the steps of installing Fedora Server on a RockPro64 with the boot and EFI partitions on an eMMC module and rootfs on a SATA or NVMe SSD.

This guide describes installing a vanilla Fedora Server image, but it could also be used for moving an already existing Fedora rootfs to an SSD. If there is already a Fedora installation on the eMMC module, then you can start at step 3.

Requirements

Plug your Armbian microSD card into the slot on your RockPro64, and boot it up. This will be used as a maintenance/rescue disk.

1. Downloading and verifying the Fedora image

On the booted Armbian, download a fresh Fedora aarch64 raw image from the Fedora website (I’m using Fedora Server in this example):

1wget https://download.fedoraproject.org/pub/fedora/linux/releases/37/Server/aarch64/images/Fedora-Server-37-1.7.aarch64.raw.xz

Download Fedora’s GPG keys and checksum files for the raw image you’re using:

1curl -O https://getfedora.org/static/fedora.gpg
2wget https://getfedora.org/static/checksums/37/images/Fedora-Server-37-1.7-aarch64-CHECKSUM

Verify the CHECKSUM file is valid:

Note: On Armbian or other Linux distros, you may need to install the package that provides the gpgv command. On Armbian, this package is called gpgv.

1gpgv --keyring ./fedora.gpg *-CHECKSUM

The CHECKSUM file should have a good signature from one of the Fedora keys.

Check that the downloaded image’s checksum matches:

1sha256sum -c *-CHECKSUM

If the output says OK, then it’s ready to use.

2. Flashing the Fedora aarch64 image to the eMMC module

If you have an eMMC-to-USB adapter, the adapter allows you to flash Fedora aarch64 onto the eMMC module from your main PC via a USB port. You can run the arm-image-installer from your main PC and then place the eMMC module onto your RockPro64 before step 3.

Run lsblk to ensure the eMMC module and SSD are detected.

Clone the Fedora arm-image-installer git repository:

1git clone https://pagure.io/arm-image-installer.git
2cd arm-image-installer

Create a directory for the arm-image-installer and copy the files from the git repository:

1sudo mkdir /usr/share/arm-image-installer
2sudo cp -rf boards.d socs.d /usr/share/arm-image-installer/
3sudo cp -fv arm-image-installer rpi-uboot-update spi-flashing-disk update-uboot /usr/bin/

With the arm-image-installer files in place, it’s time to flash the Fedora aarch64 raw image to the eMMC module.

We’ll assume the microSD card we’re booted from is /dev/mmcblk0 and the eMMC module is /dev/mmcblk1:

1sudo arm-image-installer \
2  --image=Fedora-Server-37-1.7-aarch64.raw.xz \
3  --target=rockpro64-rk3399 \
4  --media=/dev/mmcblk1 \
5  --norootpass \
6  --resizefs \
7  --showboot \
8  --relabel

You can also pass the --addkey flag to add your SSH public key to the root user’s authorized_keys file on the flashed image.

When the arm-image-installer finishes, your eMMC module should have Fedora with the following filesystem layout:

The LVM2 member will consist of a physical volume on /dev/mmcblk1p3. This physical volume will consist of a volume group named fedora. The volume group will consist of a logical volume named root, formatted as an XFS partition. You can check this will the following commands:

1sudo pvs
2
3  PV              VG     Fmt  Attr PSize    PFree
4  /dev/mmcblk1p3  fedora lvm2 a--  <15.73g    0 
1sudo lvs
2
3  LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
4  root fedora -wi-ao---- <15.73g                                                    

Now we’re ready to move the rootfs on the logical volume to the SSD.

3. Move the rootfs on the logical volume to the SSD

Since I have a SATA SSD, mine will be named /dev/sda. If you have an NVMe SSD, the name will be something like /dev/nvme0n1.

Ensure the volume group is active:

1sudo vgchange -ay
2
3  1 logical volume(s) in volume group "fedora" now active

Use fdisk on the SSD to create a GPT label and parition:

1sudo fdisk /dev/sda

At the fdisk prompt:

Create a physical volume on the newly created SSD partition:

1pvcreate /dev/sda1

Extend the fedora volume group to the new physical volume:

1vgextend fedora /dev/sda1

Move the allocated physical extents from the old physical volume to the new one.

Note that you don’t need to specify the destination physical volume, as pvmove will use the “normal” allocation policy for the fedora volume group. According to the Red Hat documentation, the “normal” allocation policy does not place parallel stripes on the same physical volume, and since there is only one other physical volume on /dev/sda1, pvmove infers the destination is /dev/sda1

1pvmove /dev/mmcblk1p3

This command will take a while, depending on how much data is being moved.

When the pvmove command completes, remove the old volume group:

1vgreduce fedora /dev/mmcblk1p3

4. Mount the logical volume rootfs, chroot, and update GRUB

The logical volume should now be /dev/fedora/root or /dev/mapper/fedora--root.

Mount the logical volume rootfs and the proc, sys, and dev filesystems:

1sudo mount /dev/fedora/root /mnt
2sudo mount -t proc proc /mnt/proc
3sudo mount --rbind /sys /mnt/sys
4sudo mount --rbind /dev /mnt/dev

Mount the boot and EFI partitions:

1sudo mount /dev/mmcblk1p2 /mnt/boot
2sudo mount /dev/mmcblk1p1 /mnt/boot/efi

Chroot into the new rootfs:

1sudo chroot /mnt /bin/bash

Update the GRUB bootloader:

1grub2-mkconfig -o /boot/grub2/grub.cfg

Note that the updated GRUB might detect the Linux distro you’re booting from on the microSD card. This can be updated again when you boot into the new rootfs.

Once GRUB finishes updating, exit the chroot:

1exit

Unmount the boot, EFI, proc, dev, and sys filesystems:

1sudo umount -R /mnt/

We should now be able to boot into the new rootfs on the SSD.

1sudo systemctl poweroff

With the RockPro64 powered off, remove the microSD card, then power it back on.

“Here goes…something…” –me

If “something” turns out to be “booted into the new rootfs nicely”, you should be at the Fedora setup menu, or if you already had a Fedora installation, you should be at the tty login prompt. Yay, it works! You’re now using the eMMC module for the boot and EFI partitions and the SSD for the root partition. Enjoy the better disk read and write performance.

Postscript

While booted on the new root partition, you can remove the old physical volume, which should now be on /dev/mmcblk01p3.

1sudo pvremove /dev/mmcblk0p3

Now we can resize the logical volume containing the root filesystem to its maximum space in the volume group, and then grow the XFS filesystem:

1sudo lvextend -l +100%FREE /dev/fedora/root
2sudo xfs_growfs /dev/fedora/root

#Fedora   #Rockpro64   #Pine64   #Selfhosting   #Sbc