File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_install_netbsd_from_an_usb_memory_stick.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Sun Nov 20 20:55:21 2011 UTC (9 years ago) by mspo
Branches: MAIN
CVS tags: HEAD
import all of the how-to articles from the pkgsrc.se wiki

    1: This describes how to install NetBSD (i386/amd64) using a Memory Stick instead of a CD-ROM Drive.
    2: 
    3: 
    4: 
    5: **Contents**
    6: 
    7: 
    8: 
    9: [[!toc levels=3]]
   10: 
   11: 
   12: 
   13: #Easy method using mkmemstick.sh
   14: 
   15: 
   16: 
   17: [Create an image using mkmemstick.sh](http://jmcneill.spaces.live.com/blog/cns!F507161C07E89CBE!170.entry)
   18: 
   19: 
   20: 
   21: This script depends on the sysutils/cdrtools package.
   22: 
   23: 
   24: 
   25: 1 Fetch a copy of the ISO you wish to install along with [mkmemstick.sh](http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/mkmemstick.sh)
   26: 
   27: 
   28: 
   29: 2 Create a disk image from the ISO:
   30: 
   31: 
   32: 
   33:     $ sh mkmemstick.sh i386cd-5.0.1.iso i386memstick-5.0.1.img
   34: 
   35: 
   36: 
   37: 3 Write the newly created image to the memory stick as root:
   38: 
   39: 
   40: 
   41:     # dd if=i386memstick-5.0.1.img of=/dev/sd0d
   42: 
   43: 4 Boot from the USB device and follow the [installation process below](/How_to_install_NetBSD_from_an_USB_Memory_Stick/#index3h2). 
   44: 
   45: 
   46: 
   47: #Manual method
   48: 
   49: ##Make the Memory Stick bootable
   50: 
   51: 
   52: 
   53: 1 Install the Master Boot Record (MBR):
   54: 
   55: 
   56: 
   57:     # fdisk -i /dev/rsd0d
   58: 
   59: 
   60: 
   61: 2 Create an fdisk partition for NetBSD:
   62: 
   63: <pre><code>
   64: 
   65: # fdisk -u /dev/rsd0d
   66: 
   67: Disk: /dev/rsd0d
   68: 
   69: NetBSD disklabel disk geometry:
   70: 
   71: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
   72: 
   73: total sectors: 997375
   74: 
   75: BIOS disk geometry:
   76: 
   77: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
   78: 
   79: total sectors: 997375
   80: 
   81: Do you want to change our idea of what BIOS thinks? [n] n
   82: 
   83: Partition table:
   84: 
   85: 0: Primary DOS with 32 bit FAT (sysid 11)
   86: 
   87:    start 8, size 997367 (487 MB, Cyls 0-973/127/8)
   88: 
   89: 1: <UNUSED>
   90: 
   91: 2: <UNUSED>
   92: 
   93: 3: <UNUSED>
   94: 
   95: Bootselector disabled.
   96: 
   97: Which partition do you want to change?: [none] 0
   98: 
   99: The data for partition 0 is:
  100: 
  101: Primary DOS with 32 bit FAT (sysid 11)
  102: 
  103:    start 8, size 997367 (487 MB, Cyls 0-973/127/8)
  104: 
  105: sysid: [0..255 default: 11] 169
  106: 
  107: start: [0..974cyl default: 8, 0cyl, 0MB] (RETURN)
  108: 
  109: size: [0..974cyl default: 997367, 974cyl, 487MB]
  110: 
  111: bootmenu: [] (RETURN)
  112: 
  113: Partition table:
  114: 
  115: 0: NetBSD (sysid 169)
  116: 
  117:    start 8, size 997367 (487 MB, Cyls 0-973/127/8)
  118: 
  119: 1: <UNUSED>
  120: 
  121: 2 :<UNUSED>
  122: 
  123: 3: <UNUSED>
  124: 
  125: Bootselector disabled.
  126: 
  127: Which partition do you want to change?: [none] (RETURN)
  128: 
  129: We haven't written the MBR back to disk yet.  This is your last chance.
  130: 
  131: Partition table:
  132: 
  133: 0: NetBSD (sysid 169)
  134: 
  135:    start 8, size 997367 (487 MB, Cyls 0-973/127/8)
  136: 
  137: 1: <UNUSED>
  138: 
  139: 2: <UNUSED>
  140: 
  141: 3: <UNUSED>
  142: 
  143: Bootselector disabled.
  144: 
  145: Should we write new partition table? [n] y
  146: 
  147: </code></pre>
  148: 
  149: 
  150: 
  151: 3 Set the NetBSD partition active (it's partition Number 0):
  152: 
  153: <pre><code>
  154: 
  155: # fdisk -a /dev/rsd0d
  156: 
  157: Disk: /dev/rsd0d
  158: 
  159: NetBSD disklabel disk geometry:
  160: 
  161: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
  162: 
  163: total sectors: 997375
  164: 
  165: BIOS disk geometry:
  166: 
  167: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
  168: 
  169: total sectors: 997375
  170: 
  171: Partition table:
  172: 
  173: 0: NetBSD (sysid 169)
  174: 
  175:    start 8, size 997367 (487 MB, Cyls 0-973/127/8)
  176: 
  177: 1: <UNUSED>
  178: 
  179: 2: <UNUSED>
  180: 
  181: 3: <UNUSED>
  182: 
  183: Bootselector disabled.
  184: 
  185: Do you want to change the active partition? [n] y
  186: 
  187: Choosing 4 will make no partition active.
  188: 
  189: active partition: [0..4 default: 4] 0
  190: 
  191: Are you happy with this choice? [n] y
  192: 
  193: </code></pre>
  194: 
  195: 
  196: 
  197: 4 Create the NetBSD disklabel and add the partitions "a" and "d":
  198: 
  199: <pre><code>
  200: 
  201: # disklabel -i -I sd0
  202: 
  203: partition> a
  204: 
  205: Filesystem type [?] [MSDOS]: 4.2BSD
  206: 
  207: Start offset ('x' to start after partition 'x') [0.0078125c, 8s, 0.00390625M]: 63
  208: 
  209: Partition size ('$' for all remaining) [973.991c, 997367s, 486.996M]: $
  210: 
  211: partition> d
  212: 
  213: Filesystem type [?] [unused]: (RETURN)
  214: 
  215: Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: (RETURN)
  216: 
  217: Partition size ('$' for all remaining) [973.999c, 997375s, 487M]: (RETURN)
  218: 
  219: partition> W
  220: 
  221: Label disk [n]? y
  222: 
  223: Label written
  224: 
  225: We haven't written the MBR back to disk yet.  This is your last chance.
  226: 
  227: Should we write new partition table? [n] y
  228: 
  229: </code></pre>
  230: 
  231: 
  232: 
  233: 5 Create a new NetBSD filesystem on partition sd0a:
  234: 
  235: 
  236: 
  237:     # newfs /dev/rsd0a
  238: 
  239: 
  240: 
  241: 
  242: 
  243: 6 Make the partition sd0a bootable:
  244: 
  245: <pre><code>
  246: 
  247: # mkdir /stick
  248: 
  249: # mount /dev/sd0a /stick
  250: 
  251: # cp /usr/mdec/boot /stick
  252: 
  253: # umount /stick
  254: 
  255: # installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1
  256: 
  257: </code></pre>
  258: 
  259: ##Copy the installation sets to the Memory Stick
  260: 
  261: 
  262: 
  263: 7 For the installation you need an installation kernel and the installation sets. To get them, fetch for example a NetBSD CD-image file from a local FTP-Mirror [1](http://www.netbsd.org/mirrors/#ftp):
  264: 
  265: 
  266: 
  267:     $ cd /home/mark
  268: 
  269:     $ ftp -a ftp://ftp.netbsd.org/pub/NetBSD/iso/4.0.1/i386cd-4.0.1.iso
  270: 
  271: 
  272: 
  273: 
  274: 
  275: 8 Mount the CD-image file:
  276: 
  277: 
  278: 
  279:     $ su
  280: 
  281:     # mkdir /image
  282: 
  283:     # vnconfig -c vnd0 /home/mark/i386cd-4.0.1.iso
  284: 
  285:     # mount_cd9660 /dev/vnd0d /image
  286: 
  287: 
  288: 
  289: 9 Mount the Memory Stick and copy the **Install kernel** and **sets**:
  290: 
  291: 
  292: 
  293:     # mount /dev/sd0a /stick
  294: 
  295:     # cp /image/i386/binary/kernel/netbsd-INSTALL.gz /stick/netbsd.gz
  296: 
  297:     # cp -R /image/i386/binary/sets /stick/sets
  298: 
  299:     # umount /stick
  300: 
  301:     # rmdir /stick
  302: 
  303: 
  304: 
  305: 10 Umount the CD-image:
  306: 
  307: 
  308: 
  309:     # umount /image
  310: 
  311:     # vnconfig -u vnd0
  312: 
  313:     # rmdir /image
  314: 
  315: 
  316: 
  317: The Memory Stick is now ready to boot the NetBSD-Install system. Just reboot and change your BIOS to boot the USB Memory Stick.
  318: 
  319: ##The installation process
  320: 
  321: 
  322: 
  323: If the Memory Stick boots fine, proceed with the Installation as usual, but the selection of the Install-sets is not quite intuitive:
  324: 
  325: 
  326: 
  327:     "Your disk is now ready for installing the kernel and the distributions sets [...]"
  328: 
  329:     [...]
  330: 
  331:     Install from
  332: 
  333:     f: Unmounted fs
  334: 
  335: 
  336: 
  337: 
  338: 
  339: Press RETURN and the following screen appears:
  340: 
  341: 
  342: 
  343:     "Enter the unmounted local device and directory on that device where the distribution is located. [...]"
  344: 
  345: 
  346: 
  347: 
  348: 
  349: Choose the following options:
  350: 
  351: 
  352: 
  353:     a: Device             sd0a
  354: 
  355:     b: File system        ffs
  356: 
  357:     c: Base directory       
  358: 
  359:     d: Set directory      /sets
  360: 
  361: 
  362: 
  363: Yes, "c: Base directory" is left empty, because we had copied the distribution .tgz files to the /sets directory on the Memory Stick (9.)
  364: 
  365: 
  366: 
  367: Now continue with the installation as usual. Good luck!
  368: 
  369: ###Alternative Method
  370: 
  371: 
  372: 
  373: An alternative setup method saves space on the Stick at the expense of sysinst automation and is therefore more advanced. This method skips the sysinst tool by copying the sets and the **normal** GENERIC Kernel instead of the install-Kernel.
  374: 
  375: 
  376: 
  377: Extract the sets from the harddisk directly on to the Memory stick (/mnt).
  378: 
  379: 
  380: 
  381:     # tar xvfzp sets.tgz -C /mnt 
  382: 
  383: 
  384: 
  385: Extract the Kernel to the target root
  386: 
  387: 
  388: 
  389:     # tar xvfzp GENERIC-kernel.tgz -C /mnt
  390: 
  391: 
  392: 
  393: All you need to do is now to create a valid /etc/fstab and modify /etc/rc.conf to RC_CONFIGURED=yes on the target root (/mnt) and reboot. All fine tuning can be done, when you're logged in. 

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