[[!meta title="Easy Software RAID with DragonFly BSD and natacontrol(8)"]] # 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 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. [[!toc levels=2]] # Pre-steps ## 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 ### 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: ad10 .. ad18 :-) ### Problems finding the disks? But you see the controller in the dmnesg 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: ad18 ad16 ad14 ad12 da0 da1 md0 You could also use the devattr command: devattr -m driver:disk or devattr -d da\* # for example ## Chosing the right RAID You can look around in the intert for various Raid calculators A very helpful page for general info is this one: http://www.icc-usa.com/raid-calculator.asp One of the better: http://kossky.sitesled.com/tools/rcdemo_en.htm As I want to have a Backup Fileserver I am chosing 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. Dont worry, natacontrol is offering more than the listed spanning RAIDs and mirroring options. Looking into the source code on DragonFly's OpenGrok we find more options than the man pages lists: lynx http://pkgbox64.dragonflybsd.org/source/xref/DragonFly-master/sys/sys/nata.h struct ata_ioc_raid_config { int lun; int type; #define AR_JBOD 0x0001 #define AR_SPAN 0x0002 #define AR_RAID0 0x0004 #define AR_RAID1 0x0008 #define AR_RAID01 0x0010 #define AR_RAID3 0x0020 #define AR_RAID4 0x0040 #define AR_RAID5 0x0080 Ah, so we can use more than the man page documents! RAID5 is the most versatile RAID, and suitable for normal servers - Home and Office use - but in my opinion too inefficient for a backup space with financial and accounting data. 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: Just to be sure we don't overwrite the wrong disks we could list them again: natacontrol create RAID10 128 ad8 ad10 ad12 ad14 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.