File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_install_netbsd_on_raid1_using_raidframe.mdwn
Revision 1.4: download - view: text, annotated - select for diffs
Wed Sep 9 14:28:56 2020 UTC (2 months, 2 weeks ago) by kim
Branches: MAIN
CVS tags: HEAD
Use man template

    1: In this article I will explain, step by step, how to install NetBSD on a RAID-1 root disk.
    2: 
    3: **Contents**
    4: 
    5: [[!toc]]
    6: 
    7: #Foreword
    8: 
    9: 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.
   10: #Requirements
   11: 
   12: [NetBSD 5.0](http://www.netbsd.org/releases/formal-5/NetBSD-5.0.html) and 2 free harddisks :-)
   13: #Booting from the CD
   14: 
   15: Boot the NetBSD 5.0 CD and, after selecting your language and keyboard layout, navigate to
   16: 
   17:     e: Utility menu
   18: 
   19: and then
   20: 
   21:     a: Run /bin/sh
   22: 
   23: 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. 
   24: 
   25: #fdisk
   26: 
   27: 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):
   28: 
   29: # fdisk -0ua wd0  
   30: <fdisk>  
   31: fdisk: primary partition table invalid, no magic in sector 0  
   32: Disk: /dev/rwd0d  
   33: NetBSD disklabel disk geometry:  
   34: cylinders: 16645, heads: 16, sectors/track: 63 (1008 sectors/cylinder)  
   35: total sectors: 16778160  
   36:   
   37: BIOS disk geometry:  
   38: cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)  
   39: total sectors: 16778160  
   40:   
   41: Do you want to change our idea of what the BIOS thinks? [n]  
   42:   
   43: Partition 0:  
   44: <UNUSED>  
   45: The data for partition 0 is:  
   46: <UNUSED>  
   47: sysid: [0..255 default: 169]  
   48: start: [0..1044cyl default: 63, 0cyl, 0MB]  
   49: size: [0..144cyl default: 16778097, 1044cyl, 8192MB]  
   50: bootmenu: []  
   51: Do you want to change the active partition? [n] **y**  
   52: Choosing 4 will make no partition active.  
   53: active partition: [0..4 default: 0]  
   54: Are you happy with this choice? [n] **y**  
   55:   
   56: We haven't written the MBR back to disk yet.  This is your last chance.  
   57: Partition table:  
   58: 0: NetBSD (sysid 169)  
   59:     start 63, size 33555249 (16384 MB, Cyls 0-2088/183/63), Active  
   60: 1: <UNUSED>  
   61: 2: <UNUSED>  
   62: 3: <UNUSED>  
   63: Bootselector disabled.  
   64: First active partition: 0  
   65: Should we write new partition table? [n] **y**  
   66:  
   67: Do the same for wd1:
   68: 
   69:     # fdisk -0ua wd1
   70: ... see above
   71: 
   72: #disklabel
   73: 
   74: Now we need to edit the disklabel, it's easy, we just need to change one thing:
   75: 
   76: # disklabel -i -I wd0  
   77: partition> **P**  
   78: ...  
   79: e:  33555312         63       4.2BSD     ...  
   80: partition> **e**  
   81: Filesystem type [?] [4.2BSD]: **RAID**  
   82: Start offset ('x' to start after partition 'x') [0.0625c, 63s, 0.0307617M]:  
   83: Partition size ('$' for all remaining) [16644.9c, 16778097s, 8192.43M]:  
   84: partition> **W**  
   85: Label disk [n]?**y**  
   86: Label written  
   87: partition> **Q**  
   88: 
   89: Note that the letter e is only an example; you need to identify your root partition
   90: 
   91: Do the same with wd1
   92: 
   93:     # disklabel -i -I wd1
   94: ...
   95: 
   96: You may save typing by copying the configuration:
   97: 
   98:     # disklabel wd0 >/tmp/wd0.inf
   99:     # disklabel -R wd1 /tmp/wd0.inf
  100: 
  101: #raid0.conf and raidctl
  102: 
  103: Next we'll configure RAIDframe (again, check the guide above, and the [[!template id=man name="raidctl" section="8"]] manpage, what all this is about):
  104: <pre><code>
  105: # cat > /tmp/raid0.conf
  106: START array
  107: 1 2 0
  108: 
  109: START disks
  110: /dev/wd0e
  111: /dev/wd1e
  112: 
  113: START layout
  114: 128 1 1 1
  115: 
  116: START queue
  117: fifo 100
  118: ^D
  119: # raidctl -v -C /tmp/raid0.conf raid0
  120: raid0: Component /dev/wd0e being configured at col: 0
  121:          Column: 0 Num Columns: 0
  122:          Version: 0 Serial Number: 0 Mod Counter: 0
  123:          Clean: No Status: 0
  124: Number of columns do not match for /dev/wd0e
  125: /dev/wd0e is not clean!
  126: raid0: Component /dev/wd1e being configured at col: 1
  127:          Column: 0 Num Columns: 0
  128:          Version: 0 Serial Number: 0 Mod Counter: 0
  129:          Clean: No Status: 0
  130: Number of columns do not match for /dev/wd1e
  131: /dev/wd1e is not clean!
  132: raid0: There were fatal errors
  133: raid0: Fatal errors being ignored.
  134: raid0: RAID Level 1
  135: raid0: Components: /dev/wd0e /dev/wd1e
  136: raid0: Total Sectors 16777984 (8192 MB)
  137: # raidctl -v -I 2009072201 raid0
  138: # raidctl -v -i raid0
  139: Initiating re-write of parity
  140: Parity Re-write status:
  141:  98% |***************************************| ETA:    00:01 -
  142: # raidctl -v -A root raid0
  143: raid0: New autoconfig value is: 1
  144: raid0: New rootpartition value is: 1
  145: raid0: Autoconfigure: Yes
  146: raid0: Root: Yes
  147: </code></pre>
  148: #installboot
  149: 
  150: One last thing, we need to make both disks bootable:
  151: 
  152:     # installboot -o timeout=30 -v /dev/rwd0e /usr/mdec/bootxx_ffsv1
  153:     File system:		/dev/rwd0e
  154:     Primary bootstrap:	/usr/mdec/bootxx_ffsv1
  155:     Ignoring PBR with invalid magic in sector 0 of '/dev/rwd0e'
  156:     Boot options:		timeout 30, flags 0, speed 9600, ioaddr 0, console pc
  157:     # installboot -o timeout=30 -v /dev/rwd1e /usr/mdec/bootxx_ffsv1
  158:     ...
  159: 
  160: #Returning to sysinst
  161: 
  162: 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):
  163: 
  164:     # exit

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