Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Configure initramfs to be able to use md (multi-disk) arrays.
#!/bin/bash -e
# Goal:
# Configure initramfs to be able to use md (multi-disk) arrays.
# Inspiration:
# Notes:
# The initramfs is tied to the current version of the kernel. Upgrading the kernel without upgrading
# initramfs could brick the Hive! Uprading the kernel, for eample using `apt-get upgrade`, will not
# upgrade the initramfs. You can use this script as a roadmap; do NOT run this straight up, as it will
# not do the right thing!!!
# Prerequisites:
# 1. Runing on rPi.
echo "Are we superuser?"
[[ $EUID -eq 0 ]]
echo "OK"
echo "Are we running on the rPi?"
[[ "$(uname --machine)" == arm* ]]
echo "OK"
echo "Update the initramfs."
printf "\nraid1\nmd_mod\next2\n" >> /etc/initramfs-tools/modules
update-initramfs -c -k $(uname --kernel-release)
echo "OK"
echo "Configure boot parameters in config.txt."
printf "\n# Boot from updated initramfs.\ninitramfs initrd.img-$(uname --kernel-release) followkernel\n" >> /boot/config.txt
echo "OK"
echo "Requires reboot."
read -n1 -r -p "Press any key to continue, Ctrl-C to abort..." ignore
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.