par HaM » 23 Fév 2004 01:06
J'avais pomper la doc sur un site web, je ne sais pas si sa va passer sur le forum, mais je test quand même!
<BR>
<BR>STEP 1: Backup your computer!
<BR>I can not stress this point strongly enough. Your first priority on a failed RAID1 system should be to perform an immediate backup.
<BR>
<BR>So, DO IT NOW!
<BR>
<BR>[root@myezserver /root]# /sbin/e-smith/backup
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 2: Power down, replace the failed drive, power up.
<BR>First, before we continue, I just want to show you that for testing purposes only, to completely erase a drive, do the following:
<BR>
<BR>[root@myezserver /root]# dd if=/dev/zero of=/dev/hdb
<BR>
<BR>This will write zeroes across the entire /dev/hdb drive. Remember for all command-line entries in this HowTO to substitute your correct /dev/hdX where:
<BR>/dev/hda = primary master
<BR>/dev/hdb = primary slave
<BR>/dev/hdc = secondary master
<BR>/dev/hdd = secondary slave
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>Step 3: Recover the partition information and use this information to quickly prepare the replacement drive.
<BR>[root@myezserver /root]# cat /root/raidmonitor/sfdisk.out
<BR># partition table of /dev/hda
<BR>unit: sectors
<BR>
<BR>/dev/hda1 : start= 63, size= 530082, Id=fd, bootable
<BR>/dev/hda2 : start= 530145, size=39487770, Id= 5
<BR>/dev/hda3 : start= 0, size= 0, Id= 0
<BR>/dev/hda4 : start= 0, size= 0, Id= 0
<BR>/dev/hda5 : start= 530208, size= 32067, Id=fd
<BR>/dev/hda6 : start= 562338, size=39455577, Id=fd
<BR># partition table of /dev/hdb
<BR>unit: sectors
<BR>
<BR>/dev/hdb1 : start= 63, size= 530082, Id=fd, bootable
<BR>/dev/hdb2 : start= 530145, size=39487770, Id= 5
<BR>/dev/hdb3 : start= 0, size= 0, Id= 0
<BR>/dev/hdb4 : start= 0, size= 0, Id= 0
<BR>/dev/hdb5 : start= 530208, size= 32067, Id=fd
<BR>/dev/hdb6 : start= 562338, size=39455577, Id=fd
<BR>Cut and paste your correct # partition table of /dev/hdX. In my case I am replacing /dev/hdb so this is the information I need to transfer into a file for quick import:
<BR>
<BR>[root@myezserver /root]# pico hdb.out
<BR>
<BR>Which now contains the following entries, right?:
<BR>
<BR># partition table of /dev/hdb
<BR>unit: sectors
<BR>
<BR>/dev/hdb1 : start= 63, size= 530082, Id=fd, bootable
<BR>/dev/hdb2 : start= 530145, size=39487770, Id= 5
<BR>/dev/hdb3 : start= 0, size= 0, Id= 0
<BR>/dev/hdb4 : start= 0, size= 0, Id= 0
<BR>/dev/hdb5 : start= 530208, size= 32067, Id=fd
<BR>/dev/hdb6 : start= 562338, size=39455577, Id=fd
<BR>
<BR>Next perform the partition table import using the sfdisk command as shown below:
<BR>
<BR>[root@myezserver /root]# sfdisk /dev/hdb < hdb.out
<BR>Checking that no-one is using this disk right now ...
<BR>OK
<BR>
<BR>Disk /dev/hdb: 2491 cylinders, 255 heads, 63 sectors/track
<BR>Old situation:
<BR>Empty
<BR>
<BR>New situation:
<BR>Units = sectors of 512 bytes, counting from 0
<BR>
<BR> Device Boot Start End #sectors Id System
<BR>/dev/hdb1 * 63 530144 530082 fd Linux raid autodetect
<BR>/dev/hdb2 530145 40017914 39487770 5 Extended
<BR>/dev/hdb3 0 - 0 0 Empty
<BR>/dev/hdb4 0 - 0 0 Empty
<BR>/dev/hdb5 530208 562274 32067 fd Linux raid autodetect
<BR>/dev/hdb6 562338 40017914 39455577 fd Linux raid autodetect
<BR>Successfully wrote the new partition table
<BR>
<BR>Re-reading the partition table ...
<BR>
<BR>If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
<BR>to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
<BR>(See fdisk(8).)
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 4: Review your last known good RAID configuration:
<BR>[root@myezserver /root]# /usr/local/bin/raidmonitor -v
<BR>
<BR>ALARM! RAID configuration problem
<BR>
<BR>Current configuration is:
<BR>
<BR>Personalities : [raid1]
<BR>read_ahead 1024 sectors
<BR>md2 : active raid1 hda1[0] 264960 blocks [2/1] [U_]
<BR>md0 : active raid1 hda5[0] 15936 blocks [2/1] [U_]
<BR>md1 : active raid1 hda6[0] 19727680 blocks [2/1] [U_]
<BR>unused devices: <none>
<BR>
<BR>Last known good configuration was:
<BR>
<BR>Personalities : [raid1]
<BR>read_ahead 1024 sectors
<BR>md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
<BR>md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
<BR>md1 : active raid1 hdb6[1] hda6[0] 19727680 blocks [2/2] [UU]
<BR>unused devices: <none>
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 5: Add your newly prepared and correctly partitioned hard drive into the RAID1 array. You use the information above as your guide:
<BR>[root@myezserver /root]# /sbin/raidhotadd /dev/md2 /dev/hdb1
<BR>[root@myezserver /root]# /sbin/raidhotadd /dev/md0 /dev/hdb5
<BR>[root@myezserver /root]# /sbin/raidhotadd /dev/md1 /dev/hdb6
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 6: Use raidmonitor to watch the recovery process. Note this information will also be e-mailed to root every 15 min. until the recovery is completed.
<BR>[root@myezserver /root]# /usr/local/bin/raidmonitor -v
<BR>
<BR>ALARM! RAID configuration problem
<BR>
<BR>Current configuration is:
<BR>
<BR>Personalities : [raid1]
<BR>read_ahead 1024 sectors
<BR>md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
<BR>md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
<BR>md1 : active raid1 hdb6[2] hda6[0] 19727680 blocks [2/1] [U_] recovery=5% finish=10.0min
<BR>unused devices: <none>
<BR>
<BR>Last known good configuration was:
<BR>
<BR>Personalities : [raid1]
<BR>read_ahead 1024 sectors
<BR>md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
<BR>md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
<BR>md1 : active raid1 hdb6[1] hda6[0] 19727680 blocks [2/2] [UU]
<BR>unused devices: <none>
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 7: Recover and restore the last known good master boot record (MBR) onto the drive you just replaced:
<BR>[root@myezserver /root]# /sbin/lilo -C /root/raidmonitor/lilo.conf -b /dev/hdb
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 8: Shutdown the server, reboot and test the RAID functions
<BR>If you have the time, you should test the RAID functionality to make sure the server will boot under simulated hdd failures.
<BR>
<BR>start by booting with both drives attached
<BR>power down, disconnect one of the drives, power up, check boot
<BR>power down, reconnect the drive, power up and rebuild the array as above repeating steps 5 and 6 only
<BR>power down, disconnect the other drive, power up, check boot
<BR>power down, reconnect the drive, power up and rebuild the array as above repeating steps 5 and 6 only
<BR>OK, now you can confidently say your ready for anything. Remember if anything goes wrong here, you simply reconnect all the hardware, perform a fresh RAID install and then restore from your backup tape. You did perform STEP 1 correct?
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 9: When all looks well, re-initialze raidmonitor:
<BR>[root@myezserver /root]# /usr/local/bin/raidmonitor -iv
<BR>
<BR>
<BR>--------------------------------------------------------------------------------
<BR>
<BR>STEP 10: Go have drink. Job well done <IMG SRC="images/smiles/icon_biggrin.gif">