Skip to content

Instantly share code, notes, and snippets.

@rcoup
Forked from alq666/bootstrap.sh
Created August 7, 2012 22:49
Show Gist options
  • Save rcoup/3290245 to your computer and use it in GitHub Desktop.
Save rcoup/3290245 to your computer and use it in GitHub Desktop.
Raid0 bootstrap for ephemeral EC2 disks
# On EC2, /mnt is usually already on
mounted=$(mount | grep /mnt | wc -l)
if [ $mounted -eq 1 ]; then
umount -l /mnt
fi
# Install mdadm and xfsprogs unattended
DEBIAN_FRONTEND=noninteractive apt-get -y install mdadm xfsprogs
# Create a RAID0 volume with 256KiB stripes, ignore what's already on the device
mdadm --create /dev/md0 --chunk=256 --level=0 --raid-devices=4 --run /dev/sdb /dev/sdc /dev/sdd /dev/sde
# Save the config
mdadm -Es | grep md0 >> /etc/mdadm/mdadm.conf
# Increase the read-ahead
blockdev --setra 65536 /dev/md0
# Create the XFS filesystem, ignore errors tied to ext3 already being there
mkfs.xfs -f -d su=256k,sw=4 /dev/md0
# Now make the volume accessible
mount -t xfs /dev/md0 /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment