Skip to content

Instantly share code, notes, and snippets.

@addisonj
Created August 8, 2012 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save addisonj/3295661 to your computer and use it in GitHub Desktop.
Save addisonj/3295661 to your computer and use it in GitHub Desktop.
while [ ! -e /dev/xvdh1 ]; do echo waiting for /dev/xvdh1 to attach; sleep 10; done
while [ ! -e /dev/xvdh2 ]; do echo waiting for /dev/xvdh2 to attach; sleep 10; done
while [ ! -e /dev/xvdh3 ]; do echo waiting for /dev/xvdh3 to attach; sleep 10; done
while [ ! -e /dev/xvdh4 ]; do echo waiting for /dev/xvdh4 to attach; sleep 10; done
while [ ! -e /dev/xvdh5 ]; do echo waiting for /dev/xvdh5 to attach; sleep 10; done
while [ ! -e /dev/xvdh6 ]; do echo waiting for /dev/xvdh6 to attach; sleep 10; done
while [ ! -e /dev/xvdh7 ]; do echo waiting for /dev/xvdh7 to attach; sleep 10; done
while [ ! -e /dev/xvdh8 ]; do echo waiting for /dev/xvdh8 to attach; sleep 10; done
apt-get update > /tmp/apt-get-update.log 2>&1
apt-get install -y mongodb-10gen > /tmp/apt-mongo.log 2>&1
service mongodb stop > /tmp/mongodb-stop.log 2>&1
sleep 5
## Create RAID10 and persist configuration
mdadm --stop --scan
mdadm --verbose --create /dev/md0 --level=10 --chunk=256 --raid-devices=8 /dev/xvdh1 /dev/xvdh2 /dev/xvdh3 /dev/xvdh4 /dev/xvdh5 /dev/xvdh6 /dev/xvdh7 /dev/xvdh8 > /tmp/mdadm.log 2>&1
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: size set to 52427520K
mdadm: Defaulting to version 1.2 metadata
mdadm: ADD_NEW_DISK for /dev/xvdh6 failed: Device or resource busy
ubuntu@ip-10-248-42-43:/tmp$ cat /proc/mdstat
Personalities :
md127 : inactive xvdh8[7](S) xvdh7[6](S) xvdh6[5](S)
157283328 blocks super 1.2
md0 : inactive xvdh5[4](S) xvdh4[3](S) xvdh3[2](S) xvdh2[1](S) xvdh1[0](S)
262138880 blocks super 1.2
unused devices: <none>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment