Skip to content

Instantly share code, notes, and snippets.

@jsierles
Created June 4, 2014 14:12
Show Gist options
  • Save jsierles/e31e37f2c3cc67a34cbb to your computer and use it in GitHub Desktop.
Save jsierles/e31e37f2c3cc67a34cbb to your computer and use it in GitHub Desktop.
#!/bin/bash -x
HOSTNAME=$HOSTNAME
# umount
umount /dev/md*
# Stop raid devices
mdadm --stop /dev/md*
# Zero 'em all
mdadm --zero-superblock /dev/sd*
sgdisk -Z /dev/sda
sgdisk -Z /dev/sdb
# Setup partition table
sgdisk -n 1:0:+30G /dev/sda # CoreOS
sgdisk -N 2 /dev/sda # Persistent storage
# Change patition types
for partnum in {1..2}; do
sgdisk -t $partnum:fd00 /dev/sda # FD00: Raid
done
# Copy them for one disk to another
sgdisk --backup=table /dev/sda
sgdisk --load-backup=table /dev/sdb
# RAID 1 setup
mdadm --create /dev/md0 --level=1 --metadata=1.2 --raid-devices=2 /dev/sda1 /dev/sdb1 # CoreOS
mdadm --create /dev/md1 --level=1 --metadata=1.2 --raid-devices=2 /dev/sda2 /dev/sdb2 # Persistent storage
mdadm --detail --scan >> /etc/mdadm.conf
./coreos-install.sh -d /dev/md0 -C alpha -c cloud-config
mount /dev/md0p9 /mnt
mkdir /mnt/etc/systemd/network
cp static.network /mnt/etc/systemd/network
umount /mnt
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment