![]() |
FIREWALL - Add a Raid Drive |
| GOAL | I want 2 disks in a mirror (RAID level 1) Initially, one of the disks had some bad sectors. I had to create 2 RAID 1 arrays (on either side of the bad sectors), then combine these into one RAID 0 array Since then, I replaced that drive and redid the array into a single RAID 1 array | ||||||||||||||||||||||||||||||
| Re-installing OpenBSD | If you are re-installing OpenBSD, all that is needed is:
raid0 : pairty status : DIRTY raid0 : Initiating re-write of parity At this point, the files originally on the raid disks are available for use | ||||||||||||||||||||||||||||||
| Support for RAID is not found in OpenBSD GENERIC, so it must be compiled into your kernel. | First copy the Kernel Source into /usr/src : Then modify the installation parameters : You may want to add the ppp modem support at this time (modem support) Now save the original kernel and overwrite with your new kernel Reboot and you will have a kernel with RAID | ||||||||||||||||||||||||||||||
| Do a surface scan of the disks to be used. Note that in OpenBSD a bad sector is a bad sector. | The Seagate site contains a nice piece of surface test software (it creates 2 boot floppies and is thereby operating system independent). Run this program, print out the test report and note any bad sectors | ||||||||||||||||||||||||||||||
| for each drive, fdisk and disklabel |
fdisk -i wd1 disklabel -E wd1 (don't set the cylinder parameters directly, use a size and let disklabel calculate the proper cylinder) In this case I ended up with:
Actually this was too much lost disk space so I purchased a replacement that was free of bad sectors.
| ||||||||||||||||||||||||||||||
| Repeat this for wd2 making sure that the disklabel is identical | |||||||||||||||||||||||||||||||
| Originally there would have been 2 RAID 1 arrays and 1 RAID 0 array merging the 2 RAID 1 arrays, we would have needed to build 3 RAID configuration files. Instead we will build one file : /root/raid0.conf |
| ||||||||||||||||||||||||||||||
| Configure and Initialize this |
# raidctl -C raid0.conf raid0 (use -C only for initial configurations) Initialize the component label # raidctl -I 112341 raid0 (112341 is the serial number for the raid set) Initialize the RAID set # raidctl -iv raid0 (i to initialize, v provides a running progress update) | ||||||||||||||||||||||||||||||
| Crate a disklabel for the RAID set: | # disklabel -E raid0
| ||||||||||||||||||||||||||||||
| Create the file system: | # newfs /dev/rraid0d | ||||||||||||||||||||||||||||||
| To test, mount the file system: copy something to it then unmount it and see that copied file doesn't appear |
#cd / #mkdir pub # mount /dev/raid0d /pub #cp /etc/fstab /pub/ #ls /pub #umount /pub #ls /pub | ||||||||||||||||||||||||||||||
| To manually regain the RAID array after reboot | Use: # raidctl -c raid0.conf raid0 to re-configure the RAID set the next time it is needed | ||||||||||||||||||||||||||||||
| Setup to automatically configure the RAID array on reboot | #raidctl -A yes raid0 (If this is after a reboot, you will need to enter #raidctl -c raid0.conf raid0 ) | ||||||||||||||||||||||||||||||
| Setup to automatically mount the RAID array on reboot | edit fstab add the line | ||||||||||||||||||||||||||||||
| Reboot, then make the drive sharable |
cd / chmod 4777 /pub | ||||||||||||||||||||||||||||||
| To check status of the array | #raidctl -s raid0 This will list the status of each drive in the array and the parity status | ||||||||||||||||||||||||||||||
| To recover a failed drive after it has been replaced | assuming the failed drive was /dev/wd2d #raidctl -R /dev/wd2d raid0 | ||||||||||||||||||||||||||||||
| If the root drive is rebuilt | Recompile the Kernel as described above After reboot you should see: This rewrite will take a long time and the server will NOT be available until it completes |