1 [[!meta title="Easy Software RAID with DragonFly BSD"]]
3 *** This Document is _still_ work in progress ***
6 I am running 2.11-DEVELOPMENT DragonFly 64Bit with i5 Core on an IntelĀ® Server-Mainboard S1200BT with 8GB RAM.
7 The Main System is on two Disks mirrored RAID1 with 500GB each.
9 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.
12 On an already running System I want to add a cheap inexpensive pool of disks keeping mission critical data.
13 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).
19 ## Don't configure the SATA Adapter in the BIOS
20 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.
22 ## Identifying the disks
23 After booting up the system please check that the Adapter you are going to use is correctly found.
27 atapci1: <SiI 3114 SATA150 controller> port 0xe100-0xe10f,0xe110-0xe113,0xe120-0xe127,0xe130-0xe133,0xe140-0xe147 mem 0xfe4a1000-0xfe4a13ff irq 21 at device 0.0 on pci1
29 ### let natacontrol look out for our possible drives
30 su-4.2# natacontrol list
32 Master: no device present
33 Slave: no device present
35 Master: no device present
36 Slave: no device present
38 Master: ad8 <WDC WD10EALX-009BA0/15.01H15> Serial ATA II
39 Slave: no device present
41 Master: ad10 <WDC WD10EALX-009BA0/15.01H15> Serial ATA II
42 Slave: no device present
44 Master: ad12 <WDC WD10EALX-009BA0/15.01H15> Serial ATA II
45 Slave: no device present
47 Master: ad14 <WDC WD10EALX-759BA1/17.01H17> Serial ATA II
48 Slave: no device present
50 Master: ad16 <WDC WD5000AADS-00S9B0/01.00A01> Serial ATA II
51 Slave: no device present
53 Master: ad18 <WDC WD5000AADS-00S9B0/01.00A01> Serial ATA II
54 Slave: no device present
56 Perfect, there they are: ad10 .. ad18 :-)
59 #### Problems finding the disks?
60 But you see the controller in the dmnesg message?
61 First, maybe natacontrol doesn't find them because the ata channel is not attached.
62 So attach it first! You can operate on the channels with the following commands:
63 natacontrol info channel
64 natacontrol attach channel
65 natacontrol detach channel
66 natacontrol reinit channel
68 Do it, until natacontrol can list all single disks you are going to use.
70 For further investigation you can try out other commands to find the disks:
71 also look out for the disks
75 kern.disks: ad18 ad16 ad14 ad12 da0 da1 md0
78 You could also use the devattr command:
79 devattr -m driver:disk
81 devattr -d da\* # for example
84 # Chosing the right RAID
85 You can look around in the intert for various Raid calculators
86 A very helpful page for general info is this one:
87 http://www.icc-usa.com/raid-calculator.asp
88 One of the better: http://kossky.sitesled.com/tools/rcdemo_en.htm
90 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.
92 Looking at the man page of natacontrol(8) we see our software RAID options:
94 create Create a type ATA RAID. The type can be RAID0 (stripe), RAID1
95 (mirror), RAID0+1, SPAN or JBOD. In case the RAID has a RAID0
96 component, the interleave must be specified in number of sec-
97 tors. The RAID will be created of the individual disks named
100 Dont worry, natacontrol is offering more than the listed spanning RAIDs and mirroring options.
102 Looking into the source code on DragonFly's OpenGrok we find more options than the man pages lists:
104 lynx http://pkgbox64.dragonflybsd.org/source/xref/DragonFly-master/sys/sys/nata.h
106 struct ata_ioc_raid_config {
109 #define AR_JBOD 0x0001
110 #define AR_SPAN 0x0002
111 #define AR_RAID0 0x0004
112 #define AR_RAID1 0x0008
113 #define AR_RAID01 0x0010
114 #define AR_RAID3 0x0020
115 #define AR_RAID4 0x0040
116 #define AR_RAID5 0x0080
118 Ah, so we can use more than the man page documents!
120 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.
122 As I only have 4 1TB disks I think RAID0+1 is the best solution as mentioned above.
125 ## Creating the Array
127 Let's dive into real world practice:
129 Just to be sure we don't overwrite the wrong disks we could list them again:
131 # natacontrol create RAID10 128 ad14 ad12 ad10 ad8
134 Interestingly RAID10 is accepted, I think it is just a synonym for RAID0+1.
135 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.)
137 Let's check what happened and look into the logs.
141 WARNING!! - not able to determine metadata format
142 WARNING!! - Using FreeBSD PseudoRAID metadata
143 If that is not what you want, use the BIOS to create the array
144 disk scheduler: set policy of ar1 to noop
145 ar1: 1907739MB <FreeBSD PseudoRAID RAID0+1 (stripe 128 KB)> status: READY
146 ar1: disk0 READY (master) using ad8 at ata4-master
147 ar1: disk1 READY (master) using ad10 at ata5-master
148 ar1: disk2 READY (mirror) using ad12 at ata6-master
149 ar1: disk3 READY (mirror) using ad14 at ata7-master
151 ## Configuring the RAID