====== ソフトウェアraid構築 ====== 下記のディスクでストライピングする場合 /dev/xvdb /dev/xvdc ===== fdiskでRAIDパーティション作成 ===== /dev/xvdb、/dev/xvdc 両方で行う。 # fdisk /dev/xvdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-2610, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): Using default value 2610 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 コマンドで RAID アレイを作成 ===== # mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/xvdb /dev/xvdc mdadm: /dev/xvdb appears to be part of a raid array: level=raid0 devices=2 ctime=Fri Mar 13 11:16:37 2015 mdadm: partition table exists on /dev/xvdb but will be lost or meaningless after creating array mdadm: /dev/xvdc appears to be part of a raid array: level=raid0 devices=2 ctime=Fri Mar 13 11:16:37 2015 mdadm: partition table exists on /dev/xvdc but will be lost or meaningless after creating array Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. |--level=RAID|Level RAID レベルを指定する。| |--raid-devices=|RAIDアレイを構成するデバイスの数| ===== 状態確認 ===== # cat /proc/mdstat Personalities : [raid0] md0 : active raid0 xvdc[1] xvdb[0] 41942016 blocks super 1.2 512k chunks ===== マウント ===== # mkfs -t ext4 /dev/md0 # mount /dev/md0 /mnt # df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 18102140 1250540 15932048 8% / tmpfs 248728 0 248728 0% /dev/shm /dev/xvda1 495844 96379 373865 21% /boot /dev/md0 41283904 180284 39006520 1% /mnt ===== RAID アレイを解除 ===== # umount /mnt # mdadm --stop /dev/md0