mdadm

The purpose of this document is to describe the user of mdadm (good info here).

2014-04-23 23:39:35 at 25 as root@mysql13.aws.ec1.jgs.im in ~ # cat /proc/partitions major minor #blocks name 202 1 8388608 xvda1 202 208 419430400 xvdn 202 192 419430400 xvdm 202 176 419430400 xvdl 202 160 419430400 xvdk 202 144 419430400 xvdj 202 128 419430400 xvdi 202 112 419430400 xvdh 202 96 419430400 xvdg 202 80 419430400 xvdf 202 3 917504 xvda3 # fdisk /dev/xvdf (d (delete)) n (new) p (primary) 1 (partition 1) ENTER (default start cylinder) ENTER (default ending cylinder) t (change partition's type ID) Hex code: fd (change ID to Linux raid autodetect) w (write changes and exit) 2013-04-23 23:40:36 at 31 as root@mysql13.aws.ec1.jgs.im in ~ # fdisk /dev/xvd xvda1 xvda3 xvdf xvdg xvdh xvdi xvdj xvdk xvdl xvdm xvdn

2014-04-23 23:40:36 at 31 as root@mysql13.aws.ec1.jgs.im in ~ # fdisk /dev/xvdf Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x02728b4b. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): d No partition is defined yet! Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-52216, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-52216, default 52216): Using default value 52216 Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.

  • mdadm --verbose --create /dev/md0 --level=raid10 --raid-devices=8 /dev/xvdf1 /dev/xvdg1 /dev/xvdh1 /dev/xvdi1 /dev/xvdj1 /dev/xvdk1 /dev/xvdl1 /dev/xvdm1 --spare-devices=1 /dev/xvdn1

  • watch cat /proc/mdstat

  • yum -y install xfsprogs

  • mkfs.xfs /dev/md0

  • mdadm --detail --scan >> /etc/mdadm.conf

    • mdadm --stop /dev/md0

      • mdadm: stopped /dev/md0

    • mdadm --assemble --scan

      • mdadm: /dev/md0 has been started with 8 drives and 1 spare.

  • mount -o noatime /dev/md0 /var/mysql

[Edit]