[How-To] boot with Kirkwood kernel files on USB and rootfs on HDD/SSD.
October 17, 2023 04:17PM
How to boot with Kirkwood kernel files on USB and rootfs on HDD/SSD.

This instruction is for the Kirkwood boxes that already have the new Kirkwood u-boot that I've released here.

For MVEBU boxes, the steps are similar but some adjustments will be needed (since u-boot in each those boxes is different from one another). Also, for other u-boots (such as OpenWrt version or stock u-boot) u-boot envs are different. Please post your question here in this thread.


1. Assuming you have created the rootfs on the USB drive, and has booted the system with it.

2. Create the rootfs on the HDD 1st partition.

a. If your system has multiple HDDs, you can use any of the HDDs.
b. The rootfs does not abosolutely have to be on the 1st partition. However, for future growth, I'd strongly recommend that the rootfs to be on the 1st partition of the HDD.
c. In case you have upgraded and use the USB rootfs for a while, you should clone the rootfs from USB drive to the HDD (to save time on reinstalling packages and other customization already done). See here for instruction how.
d. Or just use the latest basic rootfs and create a brand new one.

4. Change the partition labels

After the partition on the HDD has been polulated with the rootfs, change its partition to rootfs, and the USB partition to kernel.

Assuming the USB rootfs partition that you are booting with was assigned /dev/sda1 and the HDD partition was assigned /dev/sdb1.
e2label /dev/sda1 kernel
e2label /dev/sdb1 rootfs

That's it! Now reboot the system
shutdown -r now

5. Verifying that the kernel is from the USB and the running rootfs is on the HDD.

a. Since u-boot no longer exists after the kernel booted, the only sure way to tell which kernel was used in booting is: either if you have serial/net console and look at the log. Or if your kernel version on USB is not the same as one on the HDD.

b. If somehow the kernel files were loaded from the HDD rootfs partition, check the env
The device_type and devices envs should be like below (usb is first device to boot from).
devices=usb ide
disks=0 1 2 3

Note that in u-boot version newer than 2017.07-tld-1 (I've released a few), the HDD device is sata (not ide):
devices=usb sata

c. Check that the rootfs on HDD

df -h | grep sd
should show where is the rootfs partition, similar to the below example (it could be sda1, sdb1, sdc1,... depending on how the kernel assign the drive letter for all disk partitions in your system). And the HDD capacity should be a hint that root is mounted on that HDD partition.
/dev/sdb1       916G  330G  540G  38% /

6. Future clean up

If you intent to keep this system configuration, then you should only keep the following files and directory on the USB drive, and remove everything else:

Also keep the boot scripts if you are using them

After the clean up, the USB drive is no longer a rootfs, and can be used only for booting the kernel.

7. Future kernel upgrade

Whenever you upgrade the kernel on the HDD rootfs, you will need to copy the kernel files and the /boot/dts directory mentioned in Step 6 to the USB drive.

You can also use some addition tricks such (as using symlinks) to tell which kernel version these files on USB are.

Forum Wiki
bodhi's corner (buy bodhi a beer)

Edited 2 time(s). Last edit at 10/17/2023 05:24PM by bodhi.

Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.