Diff for /wikisrc/set-up_raidframe.mdwn between versions 1.4 and 1.5

version 1.4, 2011/05/17 00:36:42 version 1.5, 2011/07/06 03:48:30
Line 6  So ... Line 6  So ...
   
 Here's what I did recently to get raidframe(4) up and running on my new server.  Here's what I did recently to get raidframe(4) up and running on my new server.
   
 0. This is really important!  Read the man page for raidctl(8).  It is a long man page, but it is important to understand how things work.  And there are some actual examples towards the end, which will only make sense if you've read the intro material.  Don't be intimidated by all the detail, just RTFM before you start!  1. This is really important!  Read the man page for raidctl(8).  It is a long man page, but it is important to understand how things work.  And there are some actual examples towards the end, which will only make sense if you've read the intro material.  Don't be intimidated by all the detail, just RTFM before you start!
   
 1. Use dd(1) to completely erase the drives.  This is useful to make sure that any existing labels/wedges/etc. get removed, and also makes it easier to initialize the raidset parity.  On Western Digital SATA-II 500GB drive, it took less than two hours (each) for this step.  (The operation starts off at ~110GB/sec, but will get slower as the heads get closer to the center of the drive where there are fewer sectors per cylinder.)  2. Use dd(1) to completely erase the drives.  This is useful to make sure that any existing labels/wedges/etc. get removed, and also makes it easier to initialize the raidset parity.  On Western Digital SATA-II 500GB drive, it took less than two hours (each) for this step.  (The operation starts off at ~110GB/sec, but will get slower as the heads get closer to the center of the drive where there are fewer sectors per cylinder.)
   
         dd if=/dev/zero bs=32k of=/dev/rwd2a          dd if=/dev/zero bs=32k of=/dev/rwd2a
         dd if=/dev/zero bs=32k of=/dev/rwd3a          dd if=/dev/zero bs=32k of=/dev/rwd3a
   
 2. This step might not be necessary but I wasn't taking any chances!  Also, this step is only applicable on ports which use DOS disk layouts.  For other ports, you should be able to skip this step, and proceed directly to Step 3.  3. This step might not be necessary but I wasn't taking any chances!  Also, this step is only applicable on ports which use DOS disk layouts.  For other ports, you should be able to skip this step, and proceed directly to Step 4.
   
  Use fdisk(8) to set up DOS/Windows partition data.  Make sure you use the "-A 2048" option for alignment.   Use fdisk(8) to set up DOS/Windows partition data.  Make sure you use the "-A 2048" option for alignment.
   
Line 45  Here's what I did recently to get raidfr Line 45  Here's what I did recently to get raidfr
   
  (The "PBR is not bootable" line will not appear if you later use installboot(8) - see step 12 below.)   (The "PBR is not bootable" line will not appear if you later use installboot(8) - see step 12 below.)
   
 3. Use disklabel(8) to provide a NetBSD disklabel on each member of the raidset.  Create an 'e' partition that describes the whole disk - so it is essentially a copy of the 'c' partition.  Make sure that the offset of your 'e' partition is large enough to accomodate any architecture-specific bootstrap requirements, and that the offset is a multiple of the hard drive's native transfer size.  4. Use disklabel(8) to provide a NetBSD disklabel on each member of the raidset.  Create an 'e' partition that describes the whole disk - so it is essentially a copy of the 'c' partition.  Make sure that the offset of your 'e' partition is large enough to accomodate any architecture-specific bootstrap requirements, and that the offset is a multiple of the hard drive's native transfer size.
   
  Set the fstype on your 'e' partition to RAID (4.2BSD will also work, but not if you want to use RAID_AUTOCONFIG).   Set the fstype on your 'e' partition to RAID (4.2BSD will also work, but not if you want to use RAID_AUTOCONFIG).
   
Line 57  Here's what I did recently to get raidfr Line 57  Here's what I did recently to get raidfr
          d: 976773168       0  unused      0     0        # (Cyl.    0 - 969020)           d: 976773168       0  unused      0     0        # (Cyl.    0 - 969020)
          e: 976771120    2048    RAID                     # (Cyl.    2*- 969020)           e: 976771120    2048    RAID                     # (Cyl.    2*- 969020)
   
 4. Now create a raid.conf file to describe the raidset.  Mine is a simple RAID-1 (mirror):  5. Now create a raid.conf file to describe the raidset.  Mine is a simple RAID-1 (mirror):
   
         START array          START array
         #numrow numcol numspare          #numrow numcol numspare
Line 80  Here's what I did recently to get raidfr Line 80  Here's what I did recently to get raidfr
         START queue          START queue
         fifo 100          fifo 100
   
 5. Create the raidset using raidctl(8).  Until you do this for the first time, there are no raid "component labels" on the member drives, so you will need to use the "-C" option;  if the raidset has been previously created, you should use "-c" instead (this is what /etc/rc.d/raidframe uses at system startup).  6. Create the raidset using raidctl(8).  Until you do this for the first time, there are no raid "component labels" on the member drives, so you will need to use the "-C" option;  if the raidset has been previously created, you should use "-c" instead (this is what /etc/rc.d/raidframe uses at system startup).
   
         raidctl -C /etc/raid1.conf raid1          raidctl -C /etc/raid1.conf raid1
   
 6. Next, initialize the component labels with raidctl.  7. Next, initialize the component labels with raidctl.
   
         raidctl -I 201105061405 raid1          raidctl -I 201105061405 raid1
   
  (For serial number, I just used the current date/time; any 64-bit integer will work.)   (For serial number, I just used the current date/time; any 64-bit integer will work.)
   
 7. Now use raidctl to initialize the parity of the raidset.  On my 500GB drives, this took about 1.5 hours.  8. Now use raidctl to initialize the parity of the raidset.  On my 500GB drives, this took about 1.5 hours.
   
         raidctl -i raid1          raidctl -i raid1
   
Line 98  Here's what I did recently to get raidfr Line 98  Here's what I did recently to get raidfr
   
         raidctl -s raid1          raidctl -s raid1
   
 8. When parity is finished, you can treat the raidset as a normal disk. You will need to write a NetBSD disklabel (this label is separate from the labels on the physical drives).  Make certain that all the offsets are multiples of the drive's native block size; otherwise you will have unaligned transfers and performance will be very bad!  (This is also why, in step 2 above, we use "-A 2048" for fdisk rather than letting it default to 63!")  9. When parity is finished, you can treat the raidset as a normal disk. You will need to write a NetBSD disklabel (this label is separate from the labels on the physical drives).  Make certain that all the offsets are multiples of the drive's native block size; otherwise you will have unaligned transfers and performance will be very bad!  (This is also why, in step 2 above, we use "-A 2048" for fdisk rather than letting it default to 63!")
   
  Here is what my drive looks like:   Here is what my drive looks like:
   
Line 110  Here's what I did recently to get raidfr Line 110  Here's what I did recently to get raidfr
          f: 104857600 536870912  4.2BSD   2048 16384    0  # (Cyl. 524288 - 626687)           f: 104857600 536870912  4.2BSD   2048 16384    0  # (Cyl. 524288 - 626687)
          g: 335042432 641728512  4.2BSD   2048 16384    0  # (Cyl. 626688 - 953877*)           g: 335042432 641728512  4.2BSD   2048 16384    0  # (Cyl. 626688 - 953877*)
   
 9. Now, just as you would for a real disk, use newfs to initialize the filesystems.  Then mount them and start using your new raidset!  10. Now, just as you would for a real disk, use newfs to initialize the filesystems.  Then mount them and start using your new raidset!
   
         newfs /dev/raid1e          newfs /dev/raid1e
         mount /dev/raid1e /mnt          mount /dev/raid1e /mnt
   
 10. If your kernel includes the RAID_AUTOCONFIG option, you can use raidctl to let your system automatically reconfigure the raidset at every boot.  (If you don't do this, system startup will still take care of this, as long as your configuration file is properly named "raid[0-9].conf" or "raid[1-9][0-9].conf" and is located in /etc/ directory.)  11. If your kernel includes the RAID_AUTOCONFIG option, you can use raidctl to let your system automatically reconfigure the raidset at every boot.  (If you don't do this, system startup will still take care of this, as long as your configuration file is properly named "raid[0-9].conf" or "raid[1-9][0-9].conf" and is located in /etc/ directory.)
   
         raidctl -A yes raid1          raidctl -A yes raid1
   
 11. If you're going to boot from the raidset, you probably want to have an 'a' partition.  My bootable raidset has members wd0 and wd1, which are labeled like this:  12. If you're going to boot from the raidset, you probably want to have an 'a' partition.  My bootable raidset has members wd0 and wd1, which are labeled like this:
   
         5 partitions:          5 partitions:
         #        size    offset     fstype [fsize bsize cpg/sgs]          #        size    offset     fstype [fsize bsize cpg/sgs]
Line 127  Here's what I did recently to get raidfr Line 127  Here's what I did recently to get raidfr
          d: 488397168         0     unused      0     0        # (Cyl.      0 - 484520)           d: 488397168         0     unused      0     0        # (Cyl.      0 - 484520)
          e: 488395120      2048       RAID                     # (Cyl.      2*- 484520)           e: 488395120      2048       RAID                     # (Cyl.      2*- 484520)
   
 12. And the raidset itself has these partitions:  13. And the raidset itself has these partitions:
   
         6 partitions:          6 partitions:
         #        size    offset  fstype [fsize bsize cpg/sgs]          #        size    offset  fstype [fsize bsize cpg/sgs]
Line 138  Here's what I did recently to get raidfr Line 138  Here's what I did recently to get raidfr
          e: 125829120 104857600  4.2BSD   2048 16384    0  # (Cyl. 102400 - 225279)           e: 125829120 104857600  4.2BSD   2048 16384    0  # (Cyl. 102400 - 225279)
          f: 257708288 230686720  4.2BSD   2048 16384    0  # (Cyl. 225280 - 476948*)           f: 257708288 230686720  4.2BSD   2048 16384    0  # (Cyl. 225280 - 476948*)
   
 13. You will also need to run installboot(8) to make the raidset bootable. Do this for each member drive.  Please note that installboot is run for the RAID partition on each member disk, and NOT on the raidn disk!  This also assumes that the RAID partition (the 'e' partition, see step 4 above) starts at the beginning of the whole-NetBSD 'c' partition.  If you don't do this, I don't think that the i386 MBR boot code will be able to find your bootstrap image.  14. You will also need to run installboot(8) to make the raidset bootable. Do this for each member drive.  Please note that installboot is run for the RAID partition on each member disk, and NOT on the raidn disk!  This also assumes that the RAID partition (the 'e' partition, see step 4 above) starts at the beginning of the whole-NetBSD 'c' partition.  If you don't do this, I don't think that the i386 MBR boot code will be able to find your bootstrap image.
   
         mount /dev/raid0a /mnt          mount /dev/raid0a /mnt
         installboot /dev/wd0e /usr/mdec/bootxx_ffsv1 /mnt/boot          installboot /dev/wd0e /usr/mdec/bootxx_ffsv1 /mnt/boot
         installboot /dev/wd1e /usr/mdec/bootxx_ffsv1 /mnt/boot          installboot /dev/wd1e /usr/mdec/bootxx_ffsv1 /mnt/boot
   
 14. Finally, you need to make sure your kernel has the RAID_AUTOCONFIG option, and enable the raidset as the root device:  15. Finally, you need to make sure your kernel has the RAID_AUTOCONFIG option, and enable the raidset as the root device:
   
         raidctl -A root raid0          raidctl -A root raid0

Removed from v.1.4  
changed lines
  Added in v.1.5


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb