Redhat RAID5 setup

This article shows how to create a 3 SATA DISK RAID5 confgiuration using Oracle Enterprise Linux 5.5 aka Redhat 5.5.

I used a small 40GB drive the boot drive. This could have been anything including another Mirror but I didn’t go that nuts with my failover. I just wanted to make sure that if one of my primary DATA disks went bad, I would be able to recover with just buying another 54 dollar TB drive.

  • Load OEL 5.5 on 40GB IDE or SATA drive.
  • fdisk each of the SATA drives setting the format type to “fd”
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-121601, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601):
Using default value 121601
Command (m for help): p
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      121601   976760001   83  Linux
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!

Command (m for help): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 1First cylinder (1-121601, default 1): Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601): Using default value 121601
Command (m for help): p
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes255 heads, 63 sectors/track, 121601 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot      Start         End      Blocks   Id  System/dev/sdc1               1      121601   976760001   83  Linux
Command (m for help): tSelected partition 1Hex code (type L to list codes): fdChanged system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): wThe partition table has been altered!

  • Then run the following mdadm command line to create RAID 5 array

mdadm –create –verbose /dev/md0 –level=5 –raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1

  • Check your work to make sure the configuration is enabled.
cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[3] sdb1[1] sda1[0]
1953522816 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
[>………………..]  recovery =  0.1% (1053748/976761408) finish=568.6min speed=28594K/sec
  • Next make your filesystem on /dev/md0
mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
244203520 inodes, 488380704 blocks
24419035 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
14905 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
  • The configuration of your raid is unfortunately not saved until you run the following:
mdadm –detail –scan –verbose > /etc/mdadm.conf
  • Create your mount point directory
mkdir /mnt/DATA
  • Edit your /etc/fstab to include the following:

/dev/md0 /mnt/DATA ext3 defaults 1 2

  • mount your new 3 TB (now only 1.9 TB) drive.

mount -a

Leave a Reply

Your email address will not be published. Required fields are marked *