X-Git-Url: https://gitweb.dragonflybsd.org/ikiwiki.git/blobdiff_plain/76a0a13b2bbfc9407f9669b459c8d7ee974b188d..HEAD:/docs/docs/howtos/howtosoftwareraid/index.mdwn diff --git a/docs/docs/howtos/howtosoftwareraid/index.mdwn b/docs/docs/howtos/howtosoftwareraid/index.mdwn index bc3795c9..c1755d7b 100644 --- a/docs/docs/howtos/howtosoftwareraid/index.mdwn +++ b/docs/docs/howtos/howtosoftwareraid/index.mdwn @@ -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,22 +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: @@ -95,39 +100,15 @@ 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. - -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 +# 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: +Let's dive into real world practice and setup the RAID with a simple command: # natacontrol create RAID10 128 ad14 ad12 ad10 ad8 - ar0 created + > 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.) @@ -146,32 +127,38 @@ Let's check what happened and look into the logs. 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 the business as usual: +Now comes business as usual: - 1. initializing the new pseudo disk ar1 with fdisk +### Initializing the new pseudo disk ar1 with fdisk fdisk -BI /dev/ar1 - 2. Editing the disklabel +### 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 - disklabel64 -B -w -r /dev/ar1s0 auto # label it - disklabel64 -e ar1s0 # edit the disklabel just created and add any partitions - 3. formatting with HAMMER +### Formatting with HAMMER - newfs_hammer -L DATA /dev/ar1s0a + newfs_hammer -L DATA /dev/ar1s1a - 4. mounting, setting up fstab +### Mounting, setting up fstab mkdir /mnt/data - vi /etc/fstab # Add the appropriate entry/entries to your `/etc/fstab` + vi /etc/fstab # Add the appropriate entry/entries to your `/etc/fstab` mount /mnt/data - 5. rebooting and being HAPPY :-) +# Rebooting and being HAPPY :-) + shutdown -r now