Linux Software Raid

      Comments Off on Linux Software Raid

Fedora 12 Software Raid

I have my desktop configured with 4 1TB disk drives. The boot is a raid 1 under md0 and everything else is md1 and is a raid 5. Here is the layout:


# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md1 : active raid5 sda2[0] sdd1[3] sdc1[2] sdb1[1]
      2893415808 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

md0 : active raid1 sda1[0] sdc2[1]
      12287936 blocks [2/2] [UU]

unused devices: <none>

# blkid
/dev/sda1: UUID="87a59e19-bbbc-5248-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sda2: UUID="57d858aa-4ff4-18ee-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sdc1: UUID="57d858aa-4ff4-18ee-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sdc2: UUID="87a59e19-bbbc-5248-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sdd1: UUID="57d858aa-4ff4-18ee-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sdd2: UUID="54b4d6f0-3df6-440e-8677-69664571ad51" TYPE="swap"
/dev/sdb1: UUID="57d858aa-4ff4-18ee-bfe7-8010bc810f04" TYPE="linux_raid_member"
/dev/sdb2: UUID="bb98f3fd-be6f-4d76-92c9-8306a2ae22c4" TYPE="swap"
/dev/md0: UUID="f722d872-10ff-447b-9fc9-22a783759d4b" TYPE="ext4"
/dev/md1: UUID="0d92990a-c755-4c95-9bc5-56c6afd27770" TYPE="ext4"

The drive formatting looks as follows:

# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x273635fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1530    12288000   fd  Linux raid autodetect
/dev/sda2            1530      121601   964472001   fd  Linux raid autodetect

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x273635f2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1      120072   964472001   fd  Linux raid autodetect
/dev/sdc2          120072      121601    12288000   fd  Linux raid autodetect

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b56c6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1      120072   964472001   fd  Linux raid autodetect
/dev/sdd2          120072      121601    12288000   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00074d28

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1      120072   964472001   fd  Linux raid autodetect
/dev/sdb2          120072      121601    12288000   82  Linux swap / Solaris

Disk /dev/md0: 12.6 GB, 12582846464 bytes
2 heads, 4 sectors/track, 3071984 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 2962.9 GB, 2962857787392 bytes
2 heads, 4 sectors/track, 723353952 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

The file system is layed out as:

#
# /etc/fstab
# Created by anaconda on Wed Nov 18 06:21:12 2009
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=0d92990a-c755-4c95-9bc5-56c6afd27770 /                       ext4    defaults        1 1
UUID=f722d872-10ff-447b-9fc9-22a783759d4b /boot                   ext4    defaults        1 2
UUID=bb98f3fd-be6f-4d76-92c9-8306a2ae22c4 swap                    swap    defaults        0 0
UUID=54b4d6f0-3df6-440e-8677-69664571ad51 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

Using software raid gives the following:

# mdadm --detail --scan
ARRAY /dev/md0 metadata=0.90 UUID=87a59e19:bbbc5248:bfe78010:bc810f04
ARRAY /dev/md1 metadata=0.90 UUID=57d858aa:4ff418ee:bfe78010:bc810f04

# cat /etc/mdadm.conf
MAILADDR root
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=87a59e19:bbbc5248:bfe78010:bc810f04
ARRAY /dev/md1 level=raid5 num-devices=4 UUID=57d858aa:4ff418ee:bfe78010:bc810f04

Recently there have been reports that during upgrades that the raid is being renamed to md127. If that happens, here is an easy solution to that problem.

# mdadm --stop /dev/md127
# mdadm --assemble /dev/md1 /dev/sdc1 /dev/sda2 /dev/sdd1 /dev/sdb1
# mdadm --stop /dev/md128
# mdadm --assemble /dev/md0 /dev/sda1 /dev/sdc2

And this is what it looks like when mounted. Hopefully, I have enough information here to rebuild this by hand should the software fail badly.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              2.7T  880G  1.7T  35% /
tmpfs                 6.0G   16M  5.9G   1% /dev/shm
/dev/md0               12G  210M   11G   2% /boot

By the way, I have a video showing how you would create exactly this configuration during an installation and then the logical update from Fedora 12 directly to Fedora 14 in this configuration. I have to learn how to splice in the audio channel and then I’ll post it here.  Not to spoil the surprise but yes you can!



Facebooktwitterredditpinterestlinkedinmail