Skip to content

Instantly share code, notes, and snippets.

@tobert
Last active June 29, 2017 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tobert/4a7ebeb8fe9446687fa8 to your computer and use it in GitHub Desktop.
Save tobert/4a7ebeb8fe9446687fa8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# DANGER: ALL DATA WILL BE DELETED
# assumes disk order is consistent
# atobey@datastax.com 2015-05-09
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
die () { echo "FATAL: $*"; exit 1; }
set -x
# wipe all existing partitions
for l in c d e f g h i j k l m n
do
for part in /dev/sd$l[0-9]
do
umount $part 2>/dev/null
done
sgdisk -Z /dev/sd$l
dd if=/dev/zero of=/dev/sd$l bs=1M count=50
sgdisk -og /dev/sd$l
done
# create a single large partition on each device
count=0
for l in c d e f g h i j k l m n
do
count=$((count+1))
sgdisk -n 1:0:0 -t 1:8300 -c 1:"Data drive $count" /dev/sd$l
done
# create two RAID0 volumes, each with half of the available drives
mdadm --create /dev/md0 --chunk=256 --metadata=1.2 --raid-devices=6 --level=0 /dev/sd[cdefgh]1
mdadm --create /dev/md1 --chunk=256 --metadata=1.2 --raid-devices=6 --level=0 /dev/sd[ijklmn]1
mdadm --examine --scan > /etc/mdadm.conf
mkfs.xfs -b size=4096 -d su=262144 -d sw=6 /dev/md0
mkfs.xfs -b size=4096 -d su=262144 -d sw=6 /dev/md1
@alekiv
Copy link

alekiv commented May 19, 2016

I see that in script you are setting blocksize for xfs (-b) although in your guide your recommendations are for seting sector size (-s) to 4096.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment