Raid

From SME Server
Jump to navigation Jump to search

Hard Drives – Raid

SME Server 7 introduces a new feature - Automatic configuration of Software RAID 1, 5 or 6. RAID is a way of storing data on more than one hard drive at once, so that if one drive fails, the system will still function.

Your server will be automatically configured as follows:

  • 1 Drive - Software RAID 1 (ready to accept a second drive).
  • 2 Drives - Software RAID 1
  • 3 Drives - Software RAID 1 + 1 Hot-spare
  • 4-6 Drives - Software RAID 5 + 1 Hot-spare
  • 7+ Drives - Software RAID 6 + 1 Hot-spare

Hard Drive Layout

Mirroring drives in the same IDE channel (eg. hda and hdb) is not desirable. If that channel goes out, you may loose both drives. Also, performance will suffer slightly.

The preferred method is to use the master location on each IDE channel (eg. hda and hdc). This will ensure that if you loose one channel, the other will still operate. It will also give you the best performance.

In a 2 drive setups put each drive on a different IDE channel:

IDE 1 Master - Drive 1
IDE 1 Slave - CDROM
IDE 2 Master - Drive 2

Adding another Hard Drive Later

  • Shut down the machine
  • Install drive as master on the second IDE channel (hdc)
  • Boot up
  • Log on as admin to get to the admin console
  • Go to #5 Manage disk redundancy

It should tell you there if the drives are syncing up. Don't turn off the server until the sync is complete or it will start from the beginning again. When it is done syncing it will show a good working raid1.

Reusing Hard Drives

If it was ever installed on a Windows machine (or in some cases an old system) then you will need to clear the MBR first before installing it.

From the linux command prompt, type the following:

#dd if=/dev/zero of=/dev/hdx bs=512 count=1

You MUST reboot so that the empty partition table gets read correctly. For more information, check: http://bugs.contribs.org/show_bug.cgi?id=2154

Upgrading the Hard Drive Size

  • CAUTION MAKE A FULL BACKUP!
  • Ensure you have e-smith-base-4.16.0-33 or newer installed. [or Update to at least 7.1.3]
  1. Shut down and install larger drive in system.
  2. Boot up and manage raid to add new (larger) drive to system.
  3. Wait for raid to fully sync.
  4. Repeat steps 1-3 until all drives in system are upgraded to larger capacity.
  5. Ensure all drives have been replace with larger drives and array is in sync and redundant!
  6. Issue the following commands:
    1. mdadm --grow /dev/md2 --size=max
    2. pvresize /dev/md2
    3. lvresize -l +$(vgdisplay -c main | cut -d: -f16) main/root [-l (lower case L)]
    4. ext2online -C0 /dev/main/root [is -C0 (zero)]

Notes :

  • All of this can be done while the server is up and running with the exception of #1.
  • These instructions should work for any raid level you have as long as you have >= 2 drives
  • If you have disabled lvm
  1. you don't need the pvresize or lvresize command
  2. the final line becomes ext2online -C0 /dev/md2 (or whatever / is mounted to)


Additional Raid Info

Additional RAID info can be found here:

The Software-RAID HOWTO:
http://www.ibiblio.org/pub/linux/docs/HOWTO/other-formats/pdf/Software-RAID-HOWTO.pdf
This seems to be the definitive Howto:
http://www.tldp.org/HOWTO/LVM-HOWTO/

Raid Notes

Many on board hardware raid cards are in fact software RAID. Turn it off as cheap "fakeraid" cards aren't good. You will get better performance and reliability with Linux Software RAID (http://linux-ata.org/faq-sata-raid.html). Linux software RAID is fast and robust.

If your persisent on getting a hardware raid, buy a well supported raid card which has a proper RAID BIOS. This hides the disks and presents a single disk to Linux (http://linuxmafia.com/faq/Hardware/sata.html). Please check that it is supported by the kernel and has some form of management. Also avoid anything which requires a driver. Try googling for the exact model of RAID controller before buying it. Please note that you won't get a real hardware raid controller cheap.

It rarely happens, but sometimes when a device has finished rebuilding, its state doesn't change from "dirty" to "clean" until a reboot occurs. This is cosmetic

Restarting a RAID

Sometimes a partition will be taken offline automatically. This will happen if, for example, a read or write error is detected in a disk in the RAID set. When this happens, the details of the raid can be seen by inspecting the mdstat file. In the following example, partition hda2 (hard disk 'a', partition 2) is offline:

[root@sme]# cat /proc/mdstat Personalities : [raid1] md1 : active raid1 hda3[0] hdb3[1]

     38837056 blocks [2/2] [UU]

md2 : active raid1 hdb2[1]

     1048704 blocks [2/1] [_U]

md0 : active raid1 hda1[0] hdb1[1]

     255936 blocks [2/2] [UU]