X-Git-Url: https://gitweb.dragonflybsd.org/ikiwiki.git/blobdiff_plain/da45069e011a05ad9ae13cc75ce0cc8833232e02..HEAD:/docs/docs/howtos/howtosoftwareraid/index.mdwn diff --git a/docs/docs/howtos/howtosoftwareraid/index.mdwn b/docs/docs/howtos/howtosoftwareraid/index.mdwn index 0fa7547f..c1755d7b 100644 --- a/docs/docs/howtos/howtosoftwareraid/index.mdwn +++ b/docs/docs/howtos/howtosoftwareraid/index.mdwn @@ -1,4 +1,4 @@ -[[!meta title="Easy Software RAID with DragonFly BSD and natacontrol(8)"]] +[[!meta title="Easy Software RAID with DragonFly BSD"]] # Scenario I am running 2.11-DEVELOPMENT DragonFly 64Bit with i5 Core on an Intel® Server-Mainboard S1200BT with 8GB RAM. @@ -8,7 +8,7 @@ I want to use dfBSD as our company fileserver for important backups. Also I foun ## 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. +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]] @@ -20,7 +20,7 @@ Please make sure that the adapter is not configured (after the BIOS just before ## Identifying the disks After booting up the system please check that the Adapter you are going to use is correctly found. -dmesg reveales: +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 @@ -51,13 +51,14 @@ dmesg reveales: Master: ad18 Serial ATA II Slave: no device present -Perfect, there they are: ad10 .. ad18 :-) +Perfect, there they are: ad8 .. ad14 :-) #### Problems finding the disks? -But you see the controller in the dmnesg message? +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 @@ -70,23 +71,26 @@ also look out for the disks sysctl kern.disks - kern.disks: ad18 ad16 ad14 ad12 da0 da1 md0 + kern.disks: ad14 ad12 ad10 ad8 da0 da1 md0 You could also use the devattr command: + devattr -m driver:disk or - devattr -d da\* # for example + devattr -d ad\* # for example - -# Chosing the right RAID -You can look around in the intert for various Raid calculators +## 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: -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. +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: @@ -96,38 +100,65 @@ Looking at the man page of natacontrol(8) we see our software RAID options: 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. +As I only have 4 1TB disks I think RAID0+1 is the best solution as mentioned above. + -Looking into the source code on DragonFly's OpenGrok we find more options than the man pages lists: +# Creating the Array - lynx http://pkgbox64.dragonflybsd.org/source/xref/DragonFly-master/sys/sys/nata.h +Let's dive into real world practice and setup the RAID with a simple command: - 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! + # natacontrol create RAID10 128 ad14 ad12 ad10 ad8 + > ar1 created -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. +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.) -As I only have 4 1TB disks I think RAID0+1 is the best solution as mentioned above. +Let's check what happened and look into the logs. -## Creating the Array + # 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 -Let's dive into real world practice: +Ja, this is looking good ;-) -Just to be sure we don't overwrite the wrong disks we could list them again: - natacontrol create RAID10 128 ad8 ad10 ad12 ad14 +## Configuring the RAID -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. +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