Talk:Raid

From SME Server
Jump to navigation Jump to search

from bug 5665 The newer e2fs tools are smart enough that if you use the resize2fs tool to do the resizing with a mounted filesystem it will do the same thing ext2online used to do. They just made it so instead of having two tools you have one smart tool.

That being said the documentation may need to be updated to handle the sme8 case. However there are a lot of enhanced things you can do with the new tools in 8 that you can't do in 7. I'd like to see an entire new page explaining how to expand/grow your filesystem on 8 instead of just adding notes for where things are different.

2011-03-06: added a warning box to RAID1 -> RAID5 conversion: note taken from http://www.arkf.net/blog/?p=47


Stephdl (talk) 05:50, 4 February 2013 (MST) i need your help for correcting my english grammar, please be indulgent... i have tested all the command in a virtualbox, it works as expected.

Trex (talk) 18:44, 4 February 2013 (MST) This has been proof read and edited accordingly, if OK, will incorporate accordingly

Adding another Hard Drive Later (Raid1 array only)

ENSURE THAT THE NEW DRIVE IS THE SAME SIZE OR LARGER AS THE CURRENT DRIVE(S)

  • Shut down the machine
  • Install drive as master on the second IDE channel (hdc) or the second SATA channel (sda)
  • Boot up
  • At the login prompt log on as admin with the root password to get to the admin console
  • Go to #5 Manage disk redundancy

It will show the status and progress if the drives are syncing up. Don't turn off the server until the sync is complete or it will start syncing again from the beginning. When it is done syncing, it will show a good working Raid1.

If the Manage disk redundancy page displays the message "The free disk count must equal one" and "Manual intervention may be required", then you probably have additional hard drives that need to be disconnected while the RAID is set up. An external USB drive will have this effect, and should be unplugged.


  Note:
the addition of another drive is restricted to a Raid1 that is degraded, i.e. when the system has been installed with a single drive (/dev/hda and /dev/hdc or their SATA equivalent). The addition of a third drive to a Raid1 (i.e. a spare) is not recognized by the system. To add a spare you need to use the management tool mdadm at the command line



  Note:
I will assume the system is installed with a Raid1 array functioning with two disks sda and sdb and you want to add another disk sdc as a spare (for adding to the array automatically if one disk of the array fails). This HowTo can be adapted to other types of RAID as long as you want to add a spare disk.


First we need write the partition table from sda (or sdb) to sdc :

sfdisk -d /dev/sda > sfdisk_sda.output
sfdisk /dev/sdc < sfdisk_sda.output

Then we need to add the new partitions to the existings arrays :

mdadm --add /dev/md1 /dev/sdc1
mdadm --add /dev/md2 /dev/sdc2

Verify this with :

mdadm --detail /dev/md1
mdadm --detail /dev/md2
/dev/md1:
        Version : 0.90
  Creation Time : Sat Feb  2 22:24:38 2013
     Raid Level : raid1
     Array Size : 104320 (101.89 MiB 106.82 MB)
  Used Dev Size : 104320 (101.89 MiB 106.82 MB)
   Raid Devices : 2
  Total Devices : 3
Preferred Minor : 1
    Persistence : Superblock is persistent 

    Update Time : Mon Feb  4 13:28:43 2013
          State : clean
 Active Devices : 2
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 1 

           UUID : f97a86c5:8bb46daa:6854855e:558a3e16
         Events : 0.6

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1

       2       8       33        -      spare   /dev/sdc1

Alternatively you can try this.

cat /proc/mdstat
cat /proc/mdstat
Personalities : [raid1] 
md1 : active raid1 sdc1[2](S) sdb1[1] sda1[0]
      104320 blocks [2/2] [UU]
      
md2 : active raid1 sdc2[2](S) sdb2[1] sda2[0]
      52323584 blocks [2/2] [UU]

(S)= Spare (F)= Fail [0]= number of the disk

You should ensure that grub has been written correctly to the spare disk to ensure that it will boot correctly.


  Warning:
Grub is unable to install itself on an empty disk or empty partitions; to have the spare fully working and booting after a sync the boot partition on the spare drive needs to be duplicated:


to copy boot partition (sda=disk of the array sdc=the spare)

dd if=/dev/sda1 of=/dev/sdc1 

From within a terminal with administrator privileges :

grub
device (hd2) /dev/sdc
root (hd2,0)
setup (hd2)

Last of all, try forcing a failure of one of the original two drives and ensure that the server boots, and the RAID rebuilds corectly. You may then have to repeat this exercise to get the drives in the correct order (i.e sda/sdb in the array with sdc as the spare)