Created
January 18, 2017 18:19
-
-
Save SiKing/41d059ed6f895798a1125b59e833fe88 to your computer and use it in GitHub Desktop.
Configure initramfs to be able to use md (multi-disk) arrays.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# Goal: | |
# Configure initramfs to be able to use md (multi-disk) arrays. | |
# | |
# Inspiration: | |
# http://blog.drewwithers.com/2013/11/raspberry-pi-usb-raid1-root-partition.html | |
# | |
# 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 | |
reboot | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment