How to manage Linux MD software RAID

FIXME This part of the document is missing.

Managing Your RAID Arrays

To view the status of your raid arrays:

cat /proc/mdstat

How to Assemble RAID Under Knoppix for root fsck

First, load the software raid module:

sudo modprobe md

Now assemble your array, specifying the device mapper target where the array will be created, and the partitions to be used:

sudo mdadm --assemble --auto=yes /dev/md0 /dev/sda1 /dev/sda2

Now you can check the status of your array:

cat /proc/mdstat

Assuming everything is up and running you can proceed with the fsck:

fsck.ext3 /dev/md0

And then you can mount the file system:

mount /mnt/root /dev/md0

How to Identify a Failed Disk

View the status of your arrays noting which device the failed partition is located on (example /dev/sda1):

cat /proc/mdstat

You can then use lshw to show hardware information which should hopefully allow you to associate the device name with the make, model and serial number of the physical disk:

lshw

You can also query your disks for that information using their SMART interface:

smartctl -a /dev/sda

Using RAID for Off-Site Backup

Raid is not backup, but we can use RAID 1 to keep a removable hard-disk up to date which is then taken off-site, probably as one part of a comprehensive backup scheme. Usually the disk would be replaced with another disk as part of a cycle.

This is method is useful when you need to be able to restore a server by “just swapping the disks”, or when you have to make a backup of a disk which is difficult to copy at a file-system level, like that created by BackupPC (millions of hard-links).

Personally I use a Linux MD software RAID-1 array with three members, two internal and one in an external hot-swap bay. I cycle four disks swapping weekly, with three off-site at any one time.

First we need to fail all of the partitions on the disk to be removed, in this example four partitions on /dev/sdc:

mdadm --fail /dev/md0 /dev/sdc1
mdadm --fail /dev/md1 /dev/sdc2
mdadm --fail /dev/md2 /dev/sdc3
mdadm --fail /dev/md3 /dev/sdc4

Ideally we would now be able to hot-swap the disks, but whilst my hardware is fine for hot-swap the Linux kernel doesn't seem to support hot-swap of SATA disks. I therefore halt the system before I swap the disks:

halt

Once you've booted up again you can add the partitions from the new disks back in to your RAID array:

mdadm --add /dev/md0 /dev/sdc1
mdadm --add /dev/md1 /dev/sdc2
mdadm --add /dev/md2 /dev/sdc3
mdadm --add /dev/md3 /dev/sdc4

The partitions on that disk will then be synchronised with your active RAID partitions. This can sometimes take a while; on my system a 250GB disk syncs in about an hour.


Subscribe to the RSS feed for Andy's Debian HOWTOs

Article from Andy's Debian HOWTOs (http://www.besy.co.uk/debian/debian)

 
debian/how_to_setup_and_manage_md_software_raid_arrays.txt · Last modified: 2009/01/14 11:07 (external edit) · [Old revisions]
Recent changes RSS feed Powered by Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki