Skip to content

Instantly share code, notes, and snippets.

SiKing

Block or report user

Report or block SiKing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SiKing
SiKing / raid_check.sh
Created Jan 18, 2017
Check all raid arrays for errors.
View raid_check.sh
#!/bin/bash -e
#
# Check all raid arrays for errors.
#
# Inspiration:
# https://wiki.archlinux.org/index.php/RAID#RAID_Maintenance
#
echo "Are we superuser?"
[[ $EUID -eq 0 ]]
@SiKing
SiKing / sync_boot_partition.sh
Created Jan 18, 2017
The boot partition cannot be RAIDed on an rPi.
View sync_boot_partition.sh
#!/bin/bash -e
#
# The boot partition cannot be RAIDed on an rPi. We can periodically sync it, and if the primary card
# fails, we are then able to just swap the the cards around.
#
FIRST_SD_CARD=/dev/mmcblk0
FIRST_BOOT_PARTITION=${FIRST_SD_CARD}p1
#FIRST_ROOT_PARTITION=${FIRST_SD_CARD}p2
#FIRST_APP_PARTITION=${FIRST_SD_CARD}p3
@SiKing
SiKing / 07-setup_maintenance.sh
Created Jan 18, 2017
madadm needs some periodic maintenance scripts - each one is documented in the script.
View 07-setup_maintenance.sh
#!/bin/bash -e
#
# Goal:
# madadm needs some periodic maintenance scripts - each one is documented in the script.
#
echo "Are we superuser?"
[[ $EUID -eq 0 ]]
echo "OK"
@SiKing
SiKing / 06-create_app_raid.sh
Created Jan 18, 2017
Configure two partitions to work as RAID1.
View 06-create_app_raid.sh
#!/bin/bash -e
#
# Goal:
# Configure two partitions to work as RAID1.
#
# Prerequisites:
# 1. Run both 05-configure_root_raid_pass*.
# 2. Set the following variables:
#
FIRST_SD_CARD=/dev/mmcblk0
@SiKing
SiKing / 05-create_root_raid_pass2.sh
Created Jan 18, 2017
Configure two partitions (one already done) to work as RAID1.
View 05-create_root_raid_pass2.sh
#!/bin/bash -e
#
# Goal:
# Configure two partitions (one already done) to work as RAID1.
#
# Inspiration:
# http://blog.drewwithers.com/2013/11/raspberry-pi-usb-raid1-root-partition.html
# https://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID
#
# Prerequisites:
@SiKing
SiKing / 05-create_root_raid_pass1.sh
Created Jan 18, 2017
Configure two partitions (one currently in use) to work as RAID1.
View 05-create_root_raid_pass1.sh
#!/bin/bash -e
#
# Goal:
# Configure two partitions (one currently in use) to work as RAID1.
#
# Inspiration:
# http://blog.drewwithers.com/2013/11/raspberry-pi-usb-raid1-root-partition.html
# https://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID
#
# Prerequisites:
@SiKing
SiKing / 04-configure_initramfs.sh
Created Jan 18, 2017
Configure initramfs to be able to use md (multi-disk) arrays.
View 04-configure_initramfs.sh
#!/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
@SiKing
SiKing / 03-tune_root_filesystem.sh
Created Jan 18, 2017
Tune the root filesystem.
View 03-tune_root_filesystem.sh
#!/bin/bash -e
#
# Goal:
# Tune the root filesystem.
#
# Notes:
# Not needed if building the RAID system.
#
# Prerequisites:
# 1. Run 01-write_image_to_card.
@SiKing
SiKing / 02-create_app_partition.sh
Created Jan 18, 2017
Prepare empty space on the card to be used as /app partition.
View 02-create_app_partition.sh
#!/bin/bash -e
#
# Goal:
# Prepare empty space on the card to be used as /app partition.
#
# Notes:
# After this script, first time the Raspberry is powered on, you will see an error:
# "Could not expand filesystem, please try raspi-config or rc_gui."
# This error can be safely ignored, or it can be turned off using the sed command from line 132 in
# file: $ROOT_PARTITION/usr/lib/raspi-config/init_resize.sh
@SiKing
SiKing / 01-write_image_to_card.sh
Last active Jan 18, 2017
Burn the Raspbian OS image to an SD card.
View 01-write_image_to_card.sh
#!/bin/bash -e
#
# Goal:
# Burn the Raspbian OS image to an SD card.
#
# Prerequisites:
# 1. Download image from https://www.raspberrypi.org/downloads/raspbian/.
# 2. Unzip the image.
# 3. Set the following variables:
#
You can’t perform that action at this time.