X-Git-Url: https://gitweb.dragonflybsd.org/ikiwiki.git/blobdiff_plain/46c37750bd0a0dd658cd1f427ae87962f4c21dd6..HEAD:/docs/docs/howtos/howtosoftwareraid/index.mdwn diff --git a/docs/docs/howtos/howtosoftwareraid/index.mdwn b/docs/docs/howtos/howtosoftwareraid/index.mdwn index 307a402e..c1755d7b 100644 --- a/docs/docs/howtos/howtosoftwareraid/index.mdwn +++ b/docs/docs/howtos/howtosoftwareraid/index.mdwn @@ -1,16 +1,164 @@ -*** THIS GUIDE IS INCOMPLETE *** +[[!meta title="Easy Software RAID with DragonFly BSD"]] -[[!toc]] # Scenario I am running 2.11-DEVELOPMENT DragonFly 64Bit with i5 Core on an Intel® Server-Mainboard S1200BT with 8GB RAM. -The Main System is on two Disks mirrored RAID1 with 500GB. -I want to use dfBSD as our company Fileserver for important Backups. Also I found an old (not much used) Dawi controler (with Sillicon's SiL Chip) with 4 SATA Ports which I want to use for our Backup Fileserver. +The Main System is on two Disks mirrored RAID1 with 500GB each. + +I want to use dfBSD as our company fileserver for important backups. Also I found an old (not much used) Dawi controler (with Sillicon's SiL Chip) with 4 SATA Ports that I want to use for our Backup Fileserver. + +## Goal +On an already running System I want to add a cheap inexpensive pool of disks keeping mission critical data. +Failure tolerance is more important than speed. So here I will show you how easy it is to setup a software RAID with natacontrol(8). + +[[!toc levels=3]] # Pre-steps -## Configuring the SATA Adapter -Please make sure that the adapter is not configured (After the BIOS just before dfBSD starts) as RAID - just expose the disks individually to Dragonfly. We are going to setup a Software RAID. + +## Don't configure the SATA Adapter in the BIOS +Please make sure that the adapter is not configured (after the BIOS just before dfBSD starts) with RAID - just expose the disks individually to Dragonfly. We are going to setup a Software RAID. ## Identifying the disks -After booting up the system please check that the Adapter you are going to use is correctly found: -dmesg reveales: -atapci1: port 0xe100-0xe10f,0xe110-0xe113,0xe120-0xe127,0xe130-0xe133,0xe140-0xe147 mem 0xfe4a1000-0xfe4a13ff irq 21 at device 0.0 on pci1 +After booting up the system please check that the Adapter you are going to use is correctly found. + +dmesg reveals: + + atapci1: port 0xe100-0xe10f,0xe110-0xe113,0xe120-0xe127,0xe130-0xe133,0xe140-0xe147 mem 0xfe4a1000-0xfe4a13ff irq 21 at device 0.0 on pci1 + +### let natacontrol look out for our possible drives + su-4.2# natacontrol list + ATA channel 2: + Master: no device present + Slave: no device present + ATA channel 3: + Master: no device present + Slave: no device present + ATA channel 4: + Master: ad8 Serial ATA II + Slave: no device present + ATA channel 5: + Master: ad10 Serial ATA II + Slave: no device present + ATA channel 6: + Master: ad12 Serial ATA II + Slave: no device present + ATA channel 7: + Master: ad14 Serial ATA II + Slave: no device present + ATA channel 8: + Master: ad16 Serial ATA II + Slave: no device present + ATA channel 9: + Master: ad18 Serial ATA II + Slave: no device present + +Perfect, there they are: ad8 .. ad14 :-) + + +#### Problems finding the disks? +But you see the controller in the dmesg message? +First, maybe natacontrol doesn't find them because the ata channel is not attached. +So attach it first! You can operate on the channels with the following commands: + + natacontrol info channel + natacontrol attach channel + natacontrol detach channel + natacontrol reinit channel + +Do it, until natacontrol can list all single disks you are going to use. + +For further investigation you can try out other commands to find the disks: +also look out for the disks + + sysctl kern.disks + + kern.disks: ad14 ad12 ad10 ad8 da0 da1 md0 + + +You could also use the devattr command: + + devattr -m driver:disk + or + devattr -d ad\* # for example + + +## Choosing the right RAID +You can look around on the internet for various Raid calculators +A very helpful page for general info is this one: + +https://www.servethehome.com/raid-calculator/ + +https://www.icc-usa.com/raid-calculator/ + + +As I want to have a Backup Fileserver I am choosing a VERY HIGH fault tolerant kind of RAID10 thing. Certainly there are other maybe better ones around, like the RAID60 or even RAID50 but we have to consider what the nata(4) driver offers and that I only have 4 disks. + +Looking at the man page of natacontrol(8) we see our software RAID options: + + create Create a type ATA RAID. The type can be RAID0 (stripe), RAID1 + (mirror), RAID0+1, SPAN or JBOD. In case the RAID has a RAID0 + component, the interleave must be specified in number of sec- + tors. The RAID will be created of the individual disks named + disk0 ... diskN. + +As I only have 4 1TB disks I think RAID0+1 is the best solution as mentioned above. + + +# Creating the Array + +Let's dive into real world practice and setup the RAID with a simple command: + + # natacontrol create RAID10 128 ad14 ad12 ad10 ad8 + > ar1 created + +Interestingly RAID10 is accepted, I think it is just a synonym for RAID0+1. +The 128 is the interleave I used - which should be reasonable for this kind of setup. If you have not much space natacontrol will automatically adjust the stripe to a minor number (to 64KB a.e.) + +Let's check what happened and look into the logs. + + + # dmesg | tail + WARNING!! - not able to determine metadata format + WARNING!! - Using FreeBSD PseudoRAID metadata + If that is not what you want, use the BIOS to create the array + disk scheduler: set policy of ar1 to noop + ar1: 1907739MB status: READY + ar1: disk0 READY (master) using ad8 at ata4-master + ar1: disk1 READY (master) using ad10 at ata5-master + ar1: disk2 READY (mirror) using ad12 at ata6-master + ar1: disk3 READY (mirror) using ad14 at ata7-master + +Ja, this is looking good ;-) + +## Configuring the RAID + +This setup will allow your disk to work correctly with other operating systems that might be installed on your computer and will not confuse other operating systems' fdisk utilities. It is recommended to use this method for new disk installs. + +Now comes business as usual: + +### Initializing the new pseudo disk ar1 with fdisk + + fdisk -BI /dev/ar1 + +### Editing the disklabel + + # label it + disklabel64 -B -w -r /dev/ar1s1 auto + # edit the disklabel just created and add any partitions. In this case it's perfect to uncomment slice a and substitute 4.2BSD with HAMMER ;-) + disklabel64 -e ar1s1 + + +### Formatting with HAMMER + + newfs_hammer -L DATA /dev/ar1s1a + + +### Mounting, setting up fstab + + mkdir /mnt/data + vi /etc/fstab # Add the appropriate entry/entries to your `/etc/fstab` + mount /mnt/data + + +# Rebooting and being HAPPY :-) + + shutdown -r now