Software RAID 10

I’ve been putting off building the software RAID10 on marmaduke. Today, I put it off no longer.

The server marmaduke has six storage devices (2 IDE and 4 SATA)

$ ls -1 /dev/hd?
/dev/hde
/dev/hdf

$ ls -1 /dev/sd?
/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd

The CDROM is attached as /dev/hde and a 300GB HDD as /dev/hdf on which I’ve installed CentOS 5.2. The four SATA drives will be used to build a RAID 10. I’ve read through a number of postings on how to build a software RAID. The cleanest, shortest and clearest of them is on tgharold.com.

mknod

First, create a node for the array.

# mknod /dev/md0 b 9 0

I chose md0 since it was available.

The parameter ‘b’ directs mknod to create a block (buffered) special file.

The parameter ‘9’ is the Major version. (huh?) Seems the correct parameter can be found in /proc/devices. (see also, centos docs)

$ cat /proc/devices | grep -e "md$"
  9 md

The parameter ‘0’ corresponds to the last digit in the device /dev/md0. tgharold.com points out that the digit used in the device name should be the same as the last parameter. Why? Dunno. Something to look up some day.

fdisk

Second, partition the disks, each and every one.

# fdisk /dev/sda
# fdisk /dev/sdb
# fdisk /dev/sdc
# fdisk /dev/sdd

I don’t know why I set the boot flag. The important point is to set the ID to ‘fd’ which is ‘Linux raid autodetect’.

   Device  Boot  Start    End     Blocks  Id  System
/dev/sda1  *         1  60801  488384001  fd  Linux raid autodetect
/dev/sdb1  *         1  36481  293033601  fd  Linux raid autodetect
/dev/sdc1  *         1  36481  293033601  fd  Linux raid autodetect
/dev/sdd1  *         1  36481  293033601  fd  Linux raid autodetect

One of my drives is larger than the others. Three drives (Seagate ST3300620AS) where previously used in a RAID5. It’s impossible to find these drives any longer so I picked up the closest match (Seagate ST3500630AS). It has a larger capacity but otherwise the specs match. In a RAID10, the larger drive’s extra space (~200GB) will go unused.

I formatted the drives but perhaps it was unnecessary. I did this as a check on each drive before I began building the array. Didn’t seem to hurt anything.

# mkfs.ext3 /dev/sda1
# mkfs.ext3 /dev/sdb1
# mkfs.ext3 /dev/sdc1
# mkfs.ext3 /dev/sdd1

mdadm

Third, time to pull the trigger. Let mdadm do the heavy lifting.

# mdadm             \
  --create /dev/md0 \
  -v                \
  --raid-devices=4  \
  --chunk=32        \
  --level=raid10    \
  /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

mkfs

Fourth, whether you format the drive individually or not you must format the RAID.

# mkfs.ext3 /dev/md0

mount

Finally, mount the RAID.

# mount /dev/md0 /mnt/xen

Sweet.

$ df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00
           287G  36G  237G  14% /
/dev/hdf1   99M  19M   76M  20% /boot
tmpfs      3.9G    0  3.9G   0% /dev/shm
/dev/md0   551G 198M  523G   1% /mnt/xen

Now, where is that Xen tutorial?

Your email will never published nor shared. Required fields are marked *...

*

*

Type your comment out: