Line 1: |
Line 1: |
| ==Raid: Manual Rebuild== | | ==Raid: Manual Rebuild== |
− | {{Level|Medium}} | + | {{Level|Advanced}} |
| + | |
| + | {{Warning box|Get it right or you will lose data. Take a backup, let the raid sync}} |
| | | |
| Under Re-Write | | Under Re-Write |
Line 6: |
Line 8: |
| SME Servers Raid Options are largely automated, if you built your system with a single hard disk, or have a hard disk failure, simply logon as ''admin'' and select ''Disk Redundancy'' to add a new drive to your RAID1 array. | | SME Servers Raid Options are largely automated, if you built your system with a single hard disk, or have a hard disk failure, simply logon as ''admin'' and select ''Disk Redundancy'' to add a new drive to your RAID1 array. |
| | | |
− | == HowTo Manage/Check a RAID1 Array from the command Line == | + | == HowTo: Manage/Check a RAID1 Array from the command Line == |
| | | |
| === What is the Status of the Array === | | === What is the Status of the Array === |
Line 90: |
Line 92: |
| add_drive_to_raid: Done. | | add_drive_to_raid: Done. |
| add_drive_to_raid: grub> quit | | add_drive_to_raid: grub> quit |
| + | |
| + | == HowTo: Remove a disk from the RAID1 Array from the command Line == |
| + | |
| + | === Look at the mdstat === |
| + | |
| + | [root@ ~]# cat /proc/mdstat |
| + | Personalities : [raid1] |
| + | md2 : active raid1 sdb2[1] sda2[0] |
| + | 488279488 blocks [2/2] [UU] |
| + | |
| + | md1 : active raid1 sdb1[1] sda1[0] |
| + | 104320 blocks [2/2] [UU] |
| + | |
| + | unused devices: <none> |
| + | |
| + | === Fail and remove the disk, '''sdb''' in this case === |
| + | |
| + | [root@ ~]# mdadm --manage /dev/md2 --fail /dev/sdb2 |
| + | mdadm: set /dev/sdb2 faulty in /dev/md2 |
| + | [root@ ~]# mdadm --manage /dev/md2 --remove /dev/sdb2 |
| + | mdadm: hot removed /dev/sdb2 |
| + | [root@ ~]# mdadm --manage /dev/md1 --fail /dev/sdb1 |
| + | mdadm: set /dev/sdb1 faulty in /dev/md1 |
| + | [root@ ~]# mdadm --manage /dev/md1 --remove /dev/sdb1 |
| + | mdadm: hot removed /dev/sdb1 |
| + | |
| + | === Add the partitions back === |
| + | |
| + | [root@ ~]# mdadm --manage /dev/md1 --add /dev/sdb1 |
| + | mdadm: hot added /dev/sdb1 |
| + | [root@ ~]# mdadm --manage /dev/md2 --add /dev/sdb2 |
| + | mdadm: hot added /dev/sdb2 |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| | | |
| ===The Leadup=== | | ===The Leadup=== |
Line 118: |
Line 163: |
| | | |
| To correct this, remove the disk from the array, you will need to fail it, then remove it, the repartition and add it back to the array | | To correct this, remove the disk from the array, you will need to fail it, then remove it, the repartition and add it back to the array |
− |
| |
− | {{Warning box|Get it right or you will lose data. Take a backup, I let the raid sync anyway, probably didn't need to but things get confusing here, this was my initial screen, I thought it looked funny as sdb was the disk added.}}
| |
| | | |
| {{Note box|I'm using sdb which was right for me, it might not be for you (if it's RAID 1, there is a 50% chance it's not !)}} | | {{Note box|I'm using sdb which was right for me, it might not be for you (if it's RAID 1, there is a 50% chance it's not !)}} |
Line 125: |
Line 168: |
| ===Here we go lets fix this=== | | ===Here we go lets fix this=== |
| | | |
− | ====First another look at the mdstat====
| |
− |
| |
− | [root@ ~]# cat /proc/mdstat
| |
− | Personalities : [raid1]
| |
− | md2 : active raid1 sdb2[1] sda2[0]
| |
− | 488279488 blocks [2/2] [UU]
| |
− |
| |
− | md1 : active raid1 sdb1[1] sda1[0]
| |
− | 104320 blocks [2/2] [UU]
| |
− |
| |
− | unused devices: <none>
| |
− |
| |
− | ====Then fail and remove the disk, sdb in my case====
| |
− |
| |
− | [root@ ~]# mdadm --manage /dev/md2 --fail /dev/sdb2
| |
− | mdadm: set /dev/sdb2 faulty in /dev/md2
| |
− | [root@ ~]# mdadm --manage /dev/md2 --remove /dev/sdb2
| |
− | mdadm: hot removed /dev/sdb2
| |
− | [root@ ~]# mdadm --manage /dev/md1 --fail /dev/sdb1
| |
− | mdadm: set /dev/sdb1 faulty in /dev/md1
| |
− | [root@ ~]# mdadm --manage /dev/md1 --remove /dev/sdb1
| |
− | mdadm: hot removed /dev/sdb1
| |
| | | |
| ====Re-Partition, first clean the old partitions==== | | ====Re-Partition, first clean the old partitions==== |
Line 272: |
Line 293: |
| Calling ioctl() to re-read partition table. | | Calling ioctl() to re-read partition table. |
| Syncing disks. | | Syncing disks. |
− |
| |
− |
| |
− | ====Add the partitions back====
| |
− |
| |
− | [root@ ~]# mdadm --manage /dev/md1 --add /dev/sdb1
| |
− | mdadm: hot added /dev/sdb1
| |
− | [root@ ~]# mdadm --manage /dev/md2 --add /dev/sdb2
| |
− | mdadm: hot added /dev/sdb2
| |
| | | |
| | | |