Diff for /wikisrc/tutorials/how_to_install_netbsd_on_raid1_using_raidframe.mdwn between versions 1.1 and 1.2

version 1.1, 2011/11/20 20:55:21 version 1.2, 2012/02/05 07:14:36
Line 1 Line 1
 In this article I will explain, step by step, how to install NetBSD on a RAID-1 root disk.  In this article I will explain, step by step, how to install NetBSD on a RAID-1 root disk.
   
 **Contents**  **Contents**
   
 [[!toc]]  [[!toc]]
   
 #Foreword  #Foreword
   
 So, you just got yourself a pair of shiny new SCSI or SATA disks? You care about your data and you think backup is as important as having redundant data? You are disappointed because the netbsd raid1-root guide at [1](http://www.netbsd.org/docs/guide/en/chap-rf.html#chap-rf-ex-raid1root) looks rather complicated? You want to setup a raid1 mirror during installation? This guide is losely based on the netbsd.org guide above, so check that out as well to get a better understanding of what's happening here.  So, you just got yourself a pair of shiny new SCSI or SATA disks? You care about your data and you think backup is as important as having redundant data? You are disappointed because the netbsd raid1-root guide at [1](http://www.netbsd.org/docs/guide/en/chap-rf.html#chap-rf-ex-raid1root) looks rather complicated? You want to setup a raid1 mirror during installation? This guide is losely based on the netbsd.org guide above, so check that out as well to get a better understanding of what's happening here.
 #Requirements  #Requirements
   
 [NetBSD 5.0](http://www.netbsd.org/releases/formal-5/NetBSD-5.0.html) and 2 free harddisks :-)  [NetBSD 5.0](http://www.netbsd.org/releases/formal-5/NetBSD-5.0.html) and 2 free harddisks :-)
 #Booting from the CD  #Booting from the CD
   
 Boot the NetBSD 5.0 CD and, after selecting your language and keyboard layout, navigate to  Boot the NetBSD 5.0 CD and, after selecting your language and keyboard layout, navigate to
   
     e: Utility menu      e: Utility menu
   
 and then  and then
   
     a: Run /bin/sh      a: Run /bin/sh
   
 Now make sure you know your disk names, you can either see them during boot (you can get those messages again by typing dmesg at the shell prompt you just opened) or use something like sysctl hw.disknames. I'll use wd0 and wd01 (both as whole disk) in this guide.  Now make sure you know your disk names, you can either see them during boot (you can get those messages again by typing dmesg at the shell prompt you just opened) or use something like sysctl hw.disknames. I'll use wd0 and wd01 (both as whole disk) in this guide. 
   
 #fdisk  #fdisk
   
 Let's interactively setup the first partition on both disks with *fdisk* and mark the active partition as well (**bold text** is what you should enter, otherwise just accept the default by pressing return):  Let's interactively setup the first partition on both disks with *fdisk* and mark the active partition as well (**bold text** is what you should enter, otherwise just accept the default by pressing return):
   
 # fdisk -0ua wd0    # fdisk -0ua wd0  
 <fdisk>    <fdisk>  
 fdisk: primary partition table invalid, no magic in sector 0    fdisk: primary partition table invalid, no magic in sector 0  
 Disk: /dev/rwd0d    Disk: /dev/rwd0d  
 NetBSD disklabel disk geometry:    NetBSD disklabel disk geometry:  
 cylinders: 16645, heads: 16, sectors/track: 63 (1008 sectors/cylinder)    cylinders: 16645, heads: 16, sectors/track: 63 (1008 sectors/cylinder)  
 total sectors: 16778160    total sectors: 16778160  
      
 BIOS disk geometry:    BIOS disk geometry:  
 cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)    cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)  
 total sectors: 16778160    total sectors: 16778160  
      
 Do you want to change our idea of what the BIOS thinks? [n]    Do you want to change our idea of what the BIOS thinks? [n]  
      
 Partition 0:    Partition 0:  
 <UNUSED>    <UNUSED>  
 The data for partition 0 is:    The data for partition 0 is:  
 <UNUSED>    <UNUSED>  
 sysid: [0..255 default: 169]    sysid: [0..255 default: 169]  
 start: [0..1044cyl default: 63, 0cyl, 0MB]    start: [0..1044cyl default: 63, 0cyl, 0MB]  
 size: [0..144cyl default: 16778097, 1044cyl, 8192MB]    size: [0..144cyl default: 16778097, 1044cyl, 8192MB]  
 bootmenu: []    bootmenu: []  
 Do you want to change the active partition? [n] **y**    Do you want to change the active partition? [n] **y**  
 Choosing 4 will make no partition active.    Choosing 4 will make no partition active.  
 active partition: [0..4 default: 0]    active partition: [0..4 default: 0]  
 Are you happy with this choice? [n] **y**    Are you happy with this choice? [n] **y**  
      
 We haven't written the MBR back to disk yet.  This is your last chance.    We haven't written the MBR back to disk yet.  This is your last chance.  
 Partition table:    Partition table:  
 0: NetBSD (sysid 169)    0: NetBSD (sysid 169)  
     start 63, size 33555249 (16384 MB, Cyls 0-2088/183/63), Active        start 63, size 33555249 (16384 MB, Cyls 0-2088/183/63), Active  
 1: <UNUSED>    1: <UNUSED>  
 2: <UNUSED>    2: <UNUSED>  
 3: <UNUSED>    3: <UNUSED>  
 Bootselector disabled.    Bootselector disabled.  
 First active partition: 0    First active partition: 0  
 Should we write new partition table? [n] **y**    Should we write new partition table? [n] **y**  
     
 Do the same for wd1:  Do the same for wd1:
   
     # fdisk -0ua wd1      # fdisk -0ua wd1
 ... see above  ... see above
   
 #disklabel  #disklabel
   
 Now we need to edit the disklabel, it's easy, we just need to change one thing:  Now we need to edit the disklabel, it's easy, we just need to change one thing:
   
 # disklabel -i -I wd0    # disklabel -i -I wd0  
 partition> **P**    partition> **P**  
 ...    ...  
 e:  33555312         63       4.2BSD     ...    e:  33555312         63       4.2BSD     ...  
 partition> **e**    partition> **e**  
 Filesystem type [?] [4.2BSD]: **RAID**    Filesystem type [?] [4.2BSD]: **RAID**  
 Start offset ('x' to start after partition 'x') [0.0625c, 63s, 0.0307617M]:    Start offset ('x' to start after partition 'x') [0.0625c, 63s, 0.0307617M]:  
 Partition size ('$' for all remaining) [16644.9c, 16778097s, 8192.43M]:    Partition size ('$' for all remaining) [16644.9c, 16778097s, 8192.43M]:  
 partition> **W**    partition> **W**  
 Label disk [n]?**y**    Label disk [n]?**y**  
 Label written    Label written  
 partition> **Q**    partition> **Q**  
   
 Note that the letter e is only an example; you need to identify your root partition  Note that the letter e is only an example; you need to identify your root partition
   
 Do the same with wd1  Do the same with wd1
   
     # disklabel -i -I wd1      # disklabel -i -I wd1
 ...  ...
   
 You may save typing by copying the configuration:  You may save typing by copying the configuration:
   
     # disklabel wd0 >/tmp/wd0.inf      # disklabel wd0 >/tmp/wd0.inf
     # disklabel -R wd1 /tmp/wd0.inf      # disklabel -R wd1 /tmp/wd0.inf
   
 #raid0.conf and raidctl  #raid0.conf and raidctl
   
 Next we'll configure RAIDframe (again, check the guide above, and the [raidframe manpage](http://netbsd.gw.com/cgi-bin/man-cgi?raidctl++NetBSD-current), what all this is about):  Next we'll configure RAIDframe (again, check the guide above, and the [raidframe manpage](http://netbsd.gw.com/cgi-bin/man-cgi?raidctl++NetBSD-current), what all this is about):
 <pre><code>  <pre><code>
 # cat > /tmp/raid0.conf  # cat > /tmp/raid0.conf
 START array  START array
 1 2 0  1 2 0
   
 START disks  START disks
 /dev/wd0e  /dev/wd0e
 /dev/wd1e  /dev/wd1e
   
 START layout  START layout
 128 1 1 1  128 1 1 1
   
 START queue  START queue
 fifo 100  fifo 100
 ^D  ^D
 # raidctl -v -C /tmp/raid0.conf raid0  # raidctl -v -C /tmp/raid0.conf raid0
 raid0: Component /dev/wd0e being configured at col: 0  raid0: Component /dev/wd0e being configured at col: 0
          Column: 0 Num Columns: 0           Column: 0 Num Columns: 0
          Version: 0 Serial Number: 0 Mod Counter: 0           Version: 0 Serial Number: 0 Mod Counter: 0
          Clean: No Status: 0           Clean: No Status: 0
 Number of columns do not match for /dev/wd0e  Number of columns do not match for /dev/wd0e
 /dev/wd0e is not clean!  /dev/wd0e is not clean!
 raid0: Component /dev/wd1e being configured at col: 1  raid0: Component /dev/wd1e being configured at col: 1
          Column: 0 Num Columns: 0           Column: 0 Num Columns: 0
          Version: 0 Serial Number: 0 Mod Counter: 0           Version: 0 Serial Number: 0 Mod Counter: 0
          Clean: No Status: 0           Clean: No Status: 0
 Number of columns do not match for /dev/wd1e  Number of columns do not match for /dev/wd1e
 /dev/wd1e is not clean!  /dev/wd1e is not clean!
 raid0: There were fatal errors  raid0: There were fatal errors
 raid0: Fatal errors being ignored.  raid0: Fatal errors being ignored.
 raid0: RAID Level 1  raid0: RAID Level 1
 raid0: Components: /dev/wd0e /dev/wd1e  raid0: Components: /dev/wd0e /dev/wd1e
 raid0: Total Sectors 16777984 (8192 MB)  raid0: Total Sectors 16777984 (8192 MB)
 # raidctl -v -I 2009072201 raid0  # raidctl -v -I 2009072201 raid0
 # raidctl -v -i raid0  # raidctl -v -i raid0
 Initiating re-write of parity  Initiating re-write of parity
 Parity Re-write status:  Parity Re-write status:
  98% |***************************************| ETA:    00:01 -   98% |***************************************| ETA:    00:01 -
 # raidctl -v -A root raid0  # raidctl -v -A root raid0
 raid0: New autoconfig value is: 1  raid0: New autoconfig value is: 1
 raid0: New rootpartition value is: 1  raid0: New rootpartition value is: 1
 raid0: Autoconfigure: Yes  raid0: Autoconfigure: Yes
 raid0: Root: Yes  raid0: Root: Yes
 </code></pre>  </code></pre>
 #installboot  #installboot
   
 One last thing, we need to make both disks bootable:  One last thing, we need to make both disks bootable:
   
     # installboot -o timeout=30 -v /dev/rwd0e /usr/mdec/bootxx_ffsv1      # installboot -o timeout=30 -v /dev/rwd0e /usr/mdec/bootxx_ffsv1
     File system:                /dev/rwd0e      File system:                /dev/rwd0e
     Primary bootstrap:  /usr/mdec/bootxx_ffsv1      Primary bootstrap:  /usr/mdec/bootxx_ffsv1
     Ignoring PBR with invalid magic in sector 0 of '/dev/rwd0e'      Ignoring PBR with invalid magic in sector 0 of '/dev/rwd0e'
     Boot options:               timeout 30, flags 0, speed 9600, ioaddr 0, console pc      Boot options:               timeout 30, flags 0, speed 9600, ioaddr 0, console pc
     # installboot -o timeout=30 -v /dev/rwd1e /usr/mdec/bootxx_ffsv1      # installboot -o timeout=30 -v /dev/rwd1e /usr/mdec/bootxx_ffsv1
     ...      ...
   
 #Returning to sysinst  #Returning to sysinst
   
 And that's it, return to sysinst and continue the installation of NetBSD, just select *raid0* as the disk you want to install NetBSD to (and, of course, make sure you can boot from both disks after that):  And that's it, return to sysinst and continue the installation of NetBSD, just select *raid0* as the disk you want to install NetBSD to (and, of course, make sure you can boot from both disks after that):
   
     # exit      # exit

Removed from v.1.1  
changed lines
  Added in v.1.2


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