Diff for /wikisrc/tutorials/how_to_install_netbsd_from_an_usb_memory_stick.mdwn between versions 1.2 and 1.8

version 1.2, 2012/08/12 22:57:40 version 1.8, 2015/09/02 15:04:09
Line 1 Line 1
 This describes how to install NetBSD (i386/amd64) using a Memory Stick instead of a CD-ROM Drive.  This describes how to install NetBSD (i386/amd64) using a Memory Stick instead of a CD-ROM Drive.
   
   
   
 **Contents**  **Contents**
   
   
   
 [[!toc levels=3]]  [[!toc levels=3]]
   
   
 #With an downloaded image  # With an downloaded image
 From NetBSD 5.1.2 on for the i386 and amd64 ports it is possible to download a   From NetBSD 5.1.2 on for the i386 and amd64 ports it is possible to download a 
 memory stick image for installing instead of the CD-ROM image.  memory stick image for installing instead of downloading and transforming a CD image.
 NetBSD using a memory stick instead of a CD-ROM drive  
 From NetBSD 5.1.2 on it is possible to download a memory stick image directly   
 for installing instead of downloading and transforming a CD image.  
   
 This section describes in detail how to use this method. If you want to create   This section describes in detail how to use this method. If you want to create 
 an image yourself, please see below.  an image yourself, please see below.
   
 ##Downloading the installation image  ## Downloading the installation image
 Installation images are available on the [NetBSD  Installation images are available on the [NetBSD
 mirrors](http://www.netbsd.org/mirrors/) under the images/ directory, their  mirrors](http://www.netbsd.org/mirrors/) under the images/ directory, their
 filenames match the *install.img.gz pattern.  filenames match the *install.img.gz pattern.
   
 For example if we want to download NetBSD 6.0_BETA2 for i386:  For example if we want to download NetBSD 6.0 for i386:
   
     # ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0_BETA2/images/NetBSD-6.0_BETA2-i386-install.img.gz      # ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0/images/NetBSD-6.0-i386-install.img.gz
   
 ##Copying the installation image to the memory stick  ## Copying the installation image to the memory stick
 To prepare the memory stick under a Unix system you can just use  To prepare the memory stick under a Unix system you can just use
 [[!template id=man name="dd" section="1"]].  [[!template id=man name="dd" section="1"]].
   Whenever using dd(1), remember to set the blocksize by specifying the 
   <code>bs</code> parameter in order to speed up the write to the installation
   media a bit (e.g. 1m).
 For example if the memory stick is recognized as sd0 (**Warning: this will  For example if the memory stick is recognized as sd0 (**Warning: this will
 overwrite all the contents on your memory stick**):  overwrite all the contents on your memory stick**):
   
     # gunzip NetBSD-6.0_BETA2-i386-install.img.gz      # gunzip NetBSD-6.0-i386-install.img.gz
     # dd if=NetBSD-6.0_BETA2-i386-install.img of=/dev/rsd0d      # dd if=NetBSD-6.0-i386-install.img of=/dev/rsd0d bs=1m
   
 Whenever using dd(1), remember to set the blocksize by specifying the   
 <code>bs</code> parameter, at least with a value of 4K, i.e. the call would end   
 up with:  
   
     # dd if=NetBSD-6.0_BETA2-i386-install.img of=/dev/rsd0d bs=4K  ## Installation process
   
 ##Installation process  
 After NetBSD is booted from the memory stick the installation process is  After NetBSD is booted from the memory stick the installation process is
 usual (you can find an example in  usual (you can find an example in
 [The NetBSD Guide](http://netbsd.org/docs/guide/en/chap-exinst.html)).  [The NetBSD Guide](http://www.netbsd.org/docs/guide/en/chap-exinst.html)).
 Just pay attention when choosing the installation media: if you want  Just pay attention when choosing the installation media: if you want
 to install using the installation sets on the memory stick when  to install using the installation sets on the memory stick when
 [choosing the installation   [choosing the installation 
Line 55  select <code>g: local directory</code> a Line 45  select <code>g: local directory</code> a
 to release/).  to release/).
   
   
 #Easy method using mkmemstick.sh  # Build your own image
   Use <code>build.sh -U release install-image</code>
   with your usual build settings from your src directory.
   
 [Create an image using mkmemstick.sh](http://jmcneill.spaces.live.com/blog/cns!F507161C07E89CBE!170.entry)  
   
   
   
 This script depends on the sysutils/cdrtools package.  
   
   
   
 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)  
   
   
   
 2 Create a disk image from the ISO:  
   
   
   
     $ sh mkmemstick.sh i386cd-5.0.1.iso i386memstick-5.0.1.img  
   
   
   
 3 Write the newly created image to the memory stick as root:  
   
   Carry on with [the instructions after download](#index2h2) above.
   
   
     # dd if=i386memstick-5.0.1.img of=/dev/sd0d  # Manual method
   
 4 Boot from the USB device and follow the [installation process below](/How_to_install_NetBSD_from_an_USB_Memory_Stick/#index3h2).   
   
   
   
 #Manual method  
   
 ##Make the Memory Stick bootable  
   
   
   
 1 Install the Master Boot Record (MBR):  
   
   ## Make the Memory Stick bootable
   
   First, install the Master Boot Record (MBR):
   
     # fdisk -i /dev/rsd0d      # fdisk -i /dev/rsd0d
   
   Then, create an fdisk partition for NetBSD:
   
       # fdisk -u /dev/rsd0d
       Disk: /dev/rsd0d
       NetBSD disklabel disk geometry:
       cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
       total sectors: 997375
       BIOS disk geometry:
       cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
       total sectors: 997375
       Do you want to change our idea of what BIOS thinks? [n] n
       Partition table:
       0: Primary DOS with 32 bit FAT (sysid 11)
          start 8, size 997367 (487 MB, Cyls 0-973/127/8)
       1: <UNUSED>
       2: <UNUSED>
       3: <UNUSED>
       Bootselector disabled.
       Which partition do you want to change?: [none] 0
       The data for partition 0 is:
       Primary DOS with 32 bit FAT (sysid 11)
          start 8, size 997367 (487 MB, Cyls 0-973/127/8)
       sysid: [0..255 default: 11] 169
       start: [0..974cyl default: 8, 0cyl, 0MB] (RETURN)
       size: [0..974cyl default: 997367, 974cyl, 487MB]
       bootmenu: [] (RETURN)
       Partition table:
       0: NetBSD (sysid 169)
          start 8, size 997367 (487 MB, Cyls 0-973/127/8)
       1: <UNUSED>
       2 :<UNUSED>
       3: <UNUSED>
       Bootselector disabled.
       Which partition do you want to change?: [none] (RETURN)
       We haven't written the MBR back to disk yet.  This is your last chance.
       Partition table:
       0: NetBSD (sysid 169)
          start 8, size 997367 (487 MB, Cyls 0-973/127/8)
       1: <UNUSED>
       2: <UNUSED>
       3: <UNUSED>
       Bootselector disabled.
       Should we write new partition table? [n] y
   
   
   
   After that, set the NetBSD partition active (it's partition Number 0):
   
       # fdisk -a /dev/rsd0d
       Disk: /dev/rsd0d
       NetBSD disklabel disk geometry:
       cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
       total sectors: 997375
       BIOS disk geometry:
       cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
       total sectors: 997375
       Partition table:
       0: NetBSD (sysid 169)
          start 8, size 997367 (487 MB, Cyls 0-973/127/8)
       1: <UNUSED>
       2: <UNUSED>
       3: <UNUSED>
       Bootselector disabled.
       Do you want to change the active partition? [n] y
       Choosing 4 will make no partition active.
       active partition: [0..4 default: 4] 0
       Are you happy with this choice? [n] y
   
   Then, create the NetBSD disklabel and add the partitions "a" and "d":
   
       # disklabel -i -I sd0
       partition> a
       Filesystem type [?] [MSDOS]: 4.2BSD
       Start offset ('x' to start after partition 'x') [0.0078125c, 8s, 0.00390625M]: 63
       Partition size ('$' for all remaining) [973.991c, 997367s, 486.996M]: $
       partition> d
       Filesystem type [?] [unused]: (RETURN)
       Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: (RETURN)
       Partition size ('$' for all remaining) [973.999c, 997375s, 487M]: (RETURN)
       partition> W
       Label disk [n]? y
       Label written
       We haven't written the MBR back to disk yet.  This is your last chance.
       Should we write new partition table? [n] y
   
 2 Create an fdisk partition for NetBSD:  Next, create a new NetBSD filesystem on partition sd0a:
   
 <pre><code>  
   
 # fdisk -u /dev/rsd0d  
   
 Disk: /dev/rsd0d  
   
 NetBSD disklabel disk geometry:  
   
 cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)  
   
 total sectors: 997375  
   
 BIOS disk geometry:  
   
 cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)  
   
 total sectors: 997375  
   
 Do you want to change our idea of what BIOS thinks? [n] n  
   
 Partition table:  
   
 0: Primary DOS with 32 bit FAT (sysid 11)  
   
    start 8, size 997367 (487 MB, Cyls 0-973/127/8)  
   
 1: <UNUSED>  
   
 2: <UNUSED>  
   
 3: <UNUSED>  
   
 Bootselector disabled.  
   
 Which partition do you want to change?: [none] 0  
   
 The data for partition 0 is:  
   
 Primary DOS with 32 bit FAT (sysid 11)  
   
    start 8, size 997367 (487 MB, Cyls 0-973/127/8)  
   
 sysid: [0..255 default: 11] 169  
   
 start: [0..974cyl default: 8, 0cyl, 0MB] (RETURN)  
   
 size: [0..974cyl default: 997367, 974cyl, 487MB]  
   
 bootmenu: [] (RETURN)  
   
 Partition table:  
   
 0: NetBSD (sysid 169)  
   
    start 8, size 997367 (487 MB, Cyls 0-973/127/8)  
   
 1: <UNUSED>  
   
 2 :<UNUSED>  
   
 3: <UNUSED>  
   
 Bootselector disabled.  
   
 Which partition do you want to change?: [none] (RETURN)  
   
 We haven't written the MBR back to disk yet.  This is your last chance.  
   
 Partition table:  
   
 0: NetBSD (sysid 169)  
   
    start 8, size 997367 (487 MB, Cyls 0-973/127/8)  
   
 1: <UNUSED>  
   
 2: <UNUSED>  
   
 3: <UNUSED>  
   
 Bootselector disabled.  
   
 Should we write new partition table? [n] y  
   
 </code></pre>  
   
   
   
 3 Set the NetBSD partition active (it's partition Number 0):  
   
 <pre><code>  
   
 # fdisk -a /dev/rsd0d  
   
 Disk: /dev/rsd0d  
   
 NetBSD disklabel disk geometry:  
   
 cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)  
   
 total sectors: 997375  
   
 BIOS disk geometry:  
   
 cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)  
   
 total sectors: 997375  
   
 Partition table:  
   
 0: NetBSD (sysid 169)  
   
    start 8, size 997367 (487 MB, Cyls 0-973/127/8)  
   
 1: <UNUSED>  
   
 2: <UNUSED>  
   
 3: <UNUSED>  
   
 Bootselector disabled.  
   
 Do you want to change the active partition? [n] y  
   
 Choosing 4 will make no partition active.  
   
 active partition: [0..4 default: 4] 0  
   
 Are you happy with this choice? [n] y  
   
 </code></pre>  
   
   
   
 4 Create the NetBSD disklabel and add the partitions "a" and "d":  
   
 <pre><code>  
   
 # disklabel -i -I sd0  
   
 partition> a  
   
 Filesystem type [?] [MSDOS]: 4.2BSD  
   
 Start offset ('x' to start after partition 'x') [0.0078125c, 8s, 0.00390625M]: 63  
   
 Partition size ('$' for all remaining) [973.991c, 997367s, 486.996M]: $  
   
 partition> d  
   
 Filesystem type [?] [unused]: (RETURN)  
   
 Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: (RETURN)  
   
 Partition size ('$' for all remaining) [973.999c, 997375s, 487M]: (RETURN)  
   
 partition> W  
   
 Label disk [n]? y  
   
 Label written  
   
 We haven't written the MBR back to disk yet.  This is your last chance.  
   
 Should we write new partition table? [n] y  
   
 </code></pre>  
   
   
   
 5 Create a new NetBSD filesystem on partition sd0a:  
   
   
   
     # newfs /dev/rsd0a      # newfs /dev/rsd0a
   
   Now, make the partition sd0a bootable:
   
       # mkdir /stick
       # mount /dev/sd0a /stick
       # cp /usr/mdec/boot /stick
       # umount /stick
       # installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1
   
   
   ## Copy the installation sets to the Memory Stick
   
 6 Make the partition sd0a bootable:  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):
   
 <pre><code>  
   
 # mkdir /stick  
   
 # mount /dev/sd0a /stick  
   
 # cp /usr/mdec/boot /stick  
   
 # umount /stick  
   
 # installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1  
   
 </code></pre>  
   
 ##Copy the installation sets to the Memory Stick  
   
   
   
 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):  
   
   
   
     $ cd /home/mark      $ cd /home/mark
   
     $ ftp -a ftp://ftp.netbsd.org/pub/NetBSD/iso/4.0.1/i386cd-4.0.1.iso      $ ftp -a ftp://ftp.netbsd.org/pub/NetBSD/iso/4.0.1/i386cd-4.0.1.iso
   
   Now mount the CD-image file:
   
   
   
 8 Mount the CD-image file:  
   
   
   
     $ su      $ su
   
     # mkdir /image      # mkdir /image
   
     # vnconfig -c vnd0 /home/mark/i386cd-4.0.1.iso      # vnconfig -c vnd0 /home/mark/i386cd-4.0.1.iso
   
     # mount_cd9660 /dev/vnd0d /image      # mount_cd9660 /dev/vnd0d /image
   
   And then, mount the Memory Stick and copy the **Install kernel** and **sets**:
   
 9 Mount the Memory Stick and copy the **Install kernel** and **sets**:  
   
   
   
     # mount /dev/sd0a /stick      # mount /dev/sd0a /stick
   
     # cp /image/i386/binary/kernel/netbsd-INSTALL.gz /stick/netbsd.gz      # cp /image/i386/binary/kernel/netbsd-INSTALL.gz /stick/netbsd.gz
   
     # cp -R /image/i386/binary/sets /stick/sets      # cp -R /image/i386/binary/sets /stick/sets
   
     # umount /stick      # umount /stick
   
     # rmdir /stick      # rmdir /stick
   
   Now you can unmount the CD-image:
   
 10 Umount the CD-image:  
   
   
   
     # umount /image      # umount /image
   
     # vnconfig -u vnd0      # vnconfig -u vnd0
   
     # rmdir /image      # rmdir /image
   
   
   
 The Memory Stick is now ready to boot the NetBSD-Install system. Just reboot and change your BIOS to boot the USB Memory Stick.  The Memory Stick is now ready to boot the NetBSD-Install system. Just reboot and change your BIOS to boot the USB Memory Stick.
   
 ##The installation process  ## The installation process
   
   
   
 If the Memory Stick boots fine, proceed with the Installation as usual, but the selection of the Install-sets is not quite intuitive:  If the Memory Stick boots fine, proceed with the Installation as usual, but the selection of the Install-sets is not quite intuitive:
   
   
   
     "Your disk is now ready for installing the kernel and the distributions sets [...]"      "Your disk is now ready for installing the kernel and the distributions sets [...]"
   
     [...]      [...]
   
     Install from      Install from
   
     f: Unmounted fs      f: Unmounted fs
   
   
   
   
   
 Press RETURN and the following screen appears:  Press RETURN and the following screen appears:
   
   
   
     "Enter the unmounted local device and directory on that device where the distribution is located. [...]"      "Enter the unmounted local device and directory on that device where the distribution is located. [...]"
   
   
   
   
   
 Choose the following options:  Choose the following options:
   
   
   
     a: Device             sd0a      a: Device             sd0a
   
     b: File system        ffs      b: File system        ffs
   
     c: Base directory             c: Base directory       
   
     d: Set directory      /sets      d: Set directory      /sets
   
   
   
 Yes, "c: Base directory" is left empty, because we had copied the distribution .tgz files to the /sets directory on the Memory Stick (9.)  Yes, "c: Base directory" is left empty, because we had copied the distribution .tgz files to the /sets directory on the Memory Stick (9.)
   
   
   
 Now continue with the installation as usual. Good luck!  Now continue with the installation as usual. Good luck!
   
 ###Alternative Method  
   
   
   ## Alternative Method
   
 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.  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.
   
   Extract the sets from the harddisk directly on to the Memory stick (/mnt):
   
 Extract the sets from the harddisk directly on to the Memory stick (/mnt).  
   
   
   
     # tar xvfzp sets.tgz -C /mnt       # tar xvfzp sets.tgz -C /mnt 
   
   Extract the Kernel to the target root:
   
 Extract the Kernel to the target root  
   
   
   
     # tar xvfzp GENERIC-kernel.tgz -C /mnt      # tar xvfzp GENERIC-kernel.tgz -C /mnt
   
   
   
 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.   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. 

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


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