Annotation of wikisrc/tutorials/how_to_install_netbsd_from_an_usb_memory_stick.mdwn, revision 1.7
1.1 mspo 1: This describes how to install NetBSD (i386/amd64) using a Memory Stick instead of a CD-ROM Drive.
2:
3: **Contents**
4:
5: [[!toc levels=3]]
6:
7:
1.7 ! wiki 8: # With an downloaded image
1.2 jdf 9: From NetBSD 5.1.2 on for the i386 and amd64 ports it is possible to download a
1.4 wiki 10: memory stick image for installing instead of downloading and transforming a CD image.
1.2 jdf 11:
12: This section describes in detail how to use this method. If you want to create
13: an image yourself, please see below.
14:
1.7 ! wiki 15: ## Downloading the installation image
1.2 jdf 16: Installation images are available on the [NetBSD
17: mirrors](http://www.netbsd.org/mirrors/) under the images/ directory, their
18: filenames match the *install.img.gz pattern.
19:
1.3 wiki 20: For example if we want to download NetBSD 6.0 for i386:
1.2 jdf 21:
1.3 wiki 22: # ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0/images/NetBSD-6.0-i386-install.img.gz
1.2 jdf 23:
1.7 ! wiki 24: ## Copying the installation image to the memory stick
1.2 jdf 25: To prepare the memory stick under a Unix system you can just use
26: [[!template id=man name="dd" section="1"]].
27: For example if the memory stick is recognized as sd0 (**Warning: this will
28: overwrite all the contents on your memory stick**):
29:
1.3 wiki 30: # gunzip NetBSD-6.0-i386-install.img.gz
31: # dd if=NetBSD-6.0-i386-install.img of=/dev/rsd0d
1.2 jdf 32:
33: Whenever using dd(1), remember to set the blocksize by specifying the
34: <code>bs</code> parameter, at least with a value of 4K, i.e. the call would end
35: up with:
36:
1.3 wiki 37: # dd if=NetBSD-6.0-i386-install.img of=/dev/rsd0d bs=4K
1.2 jdf 38:
1.7 ! wiki 39: ## Installation process
1.2 jdf 40: After NetBSD is booted from the memory stick the installation process is
41: usual (you can find an example in
1.5 wiki 42: [The NetBSD Guide](http://www.netbsd.org/docs/guide/en/chap-exinst.html)).
1.2 jdf 43: Just pay attention when choosing the installation media: if you want
44: to install using the installation sets on the memory stick when
45: [choosing the installation
46: media](http://www.netbsd.org/docs/guide/en/chap-exinst.html#exinst-choose-media)
47: select <code>g: local directory</code> and then clear the *base* (by default it points
48: to release/).
49:
1.1 mspo 50:
1.7 ! wiki 51: # Build your own image
1.6 wiki 52: Use <code>build.sh -U release install-image</code>
1.5 wiki 53: with your usual build settings from your src directory.
1.1 mspo 54:
1.5 wiki 55: Carry on with [the instructions after download](#index2h2) above.
1.1 mspo 56:
57:
1.7 ! wiki 58: # Manual method
1.1 mspo 59:
1.7 ! wiki 60: ## Make the Memory Stick bootable
1.1 mspo 61:
1.7 ! wiki 62: First, install the Master Boot Record (MBR):
1.1 mspo 63:
64: # fdisk -i /dev/rsd0d
65:
1.7 ! wiki 66: Then, create an fdisk partition for NetBSD:
1.1 mspo 67:
1.7 ! wiki 68: # fdisk -u /dev/rsd0d
! 69: Disk: /dev/rsd0d
! 70: NetBSD disklabel disk geometry:
! 71: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
! 72: total sectors: 997375
! 73: BIOS disk geometry:
! 74: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
! 75: total sectors: 997375
! 76: Do you want to change our idea of what BIOS thinks? [n] n
! 77: Partition table:
! 78: 0: Primary DOS with 32 bit FAT (sysid 11)
! 79: start 8, size 997367 (487 MB, Cyls 0-973/127/8)
! 80: 1: <UNUSED>
! 81: 2: <UNUSED>
! 82: 3: <UNUSED>
! 83: Bootselector disabled.
! 84: Which partition do you want to change?: [none] 0
! 85: The data for partition 0 is:
! 86: Primary DOS with 32 bit FAT (sysid 11)
! 87: start 8, size 997367 (487 MB, Cyls 0-973/127/8)
! 88: sysid: [0..255 default: 11] 169
! 89: start: [0..974cyl default: 8, 0cyl, 0MB] (RETURN)
! 90: size: [0..974cyl default: 997367, 974cyl, 487MB]
! 91: bootmenu: [] (RETURN)
! 92: Partition table:
! 93: 0: NetBSD (sysid 169)
! 94: start 8, size 997367 (487 MB, Cyls 0-973/127/8)
! 95: 1: <UNUSED>
! 96: 2 :<UNUSED>
! 97: 3: <UNUSED>
! 98: Bootselector disabled.
! 99: Which partition do you want to change?: [none] (RETURN)
! 100: We haven't written the MBR back to disk yet. This is your last chance.
! 101: Partition table:
! 102: 0: NetBSD (sysid 169)
! 103: start 8, size 997367 (487 MB, Cyls 0-973/127/8)
! 104: 1: <UNUSED>
! 105: 2: <UNUSED>
! 106: 3: <UNUSED>
! 107: Bootselector disabled.
! 108: Should we write new partition table? [n] y
! 109:
! 110:
! 111:
! 112: After that, set the NetBSD partition active (it's partition Number 0):
! 113:
! 114: # fdisk -a /dev/rsd0d
! 115: Disk: /dev/rsd0d
! 116: NetBSD disklabel disk geometry:
! 117: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
! 118: total sectors: 997375
! 119: BIOS disk geometry:
! 120: cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)
! 121: total sectors: 997375
! 122: Partition table:
! 123: 0: NetBSD (sysid 169)
! 124: start 8, size 997367 (487 MB, Cyls 0-973/127/8)
! 125: 1: <UNUSED>
! 126: 2: <UNUSED>
! 127: 3: <UNUSED>
! 128: Bootselector disabled.
! 129: Do you want to change the active partition? [n] y
! 130: Choosing 4 will make no partition active.
! 131: active partition: [0..4 default: 4] 0
! 132: Are you happy with this choice? [n] y
! 133:
! 134: Then, create the NetBSD disklabel and add the partitions "a" and "d":
! 135:
! 136: # disklabel -i -I sd0
! 137: partition> a
! 138: Filesystem type [?] [MSDOS]: 4.2BSD
! 139: Start offset ('x' to start after partition 'x') [0.0078125c, 8s, 0.00390625M]: 63
! 140: Partition size ('$' for all remaining) [973.991c, 997367s, 486.996M]: $
! 141: partition> d
! 142: Filesystem type [?] [unused]: (RETURN)
! 143: Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: (RETURN)
! 144: Partition size ('$' for all remaining) [973.999c, 997375s, 487M]: (RETURN)
! 145: partition> W
! 146: Label disk [n]? y
! 147: Label written
! 148: We haven't written the MBR back to disk yet. This is your last chance.
! 149: Should we write new partition table? [n] y
1.1 mspo 150:
1.7 ! wiki 151: Next, create a new NetBSD filesystem on partition sd0a:
1.1 mspo 152:
153: # newfs /dev/rsd0a
154:
1.7 ! wiki 155: Now, make the partition sd0a bootable:
1.1 mspo 156:
1.7 ! wiki 157: # mkdir /stick
! 158: # mount /dev/sd0a /stick
! 159: # cp /usr/mdec/boot /stick
! 160: # umount /stick
! 161: # installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1
1.1 mspo 162:
163:
1.7 ! wiki 164: ## Copy the installation sets to the Memory Stick
1.1 mspo 165:
1.7 ! wiki 166: 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):
1.1 mspo 167:
168: $ cd /home/mark
169: $ ftp -a ftp://ftp.netbsd.org/pub/NetBSD/iso/4.0.1/i386cd-4.0.1.iso
170:
1.7 ! wiki 171: Now mount the CD-image file:
1.1 mspo 172:
173: $ su
174: # mkdir /image
175: # vnconfig -c vnd0 /home/mark/i386cd-4.0.1.iso
176: # mount_cd9660 /dev/vnd0d /image
177:
1.7 ! wiki 178: And then, mount the Memory Stick and copy the **Install kernel** and **sets**:
1.1 mspo 179:
180: # mount /dev/sd0a /stick
181: # cp /image/i386/binary/kernel/netbsd-INSTALL.gz /stick/netbsd.gz
182: # cp -R /image/i386/binary/sets /stick/sets
183: # umount /stick
184: # rmdir /stick
185:
1.7 ! wiki 186: Now you can unmount the CD-image:
1.1 mspo 187:
188: # umount /image
189: # vnconfig -u vnd0
190: # rmdir /image
191:
192: The Memory Stick is now ready to boot the NetBSD-Install system. Just reboot and change your BIOS to boot the USB Memory Stick.
193:
1.7 ! wiki 194: ## The installation process
1.1 mspo 195:
196: If the Memory Stick boots fine, proceed with the Installation as usual, but the selection of the Install-sets is not quite intuitive:
197:
198: "Your disk is now ready for installing the kernel and the distributions sets [...]"
199: [...]
200: Install from
201: f: Unmounted fs
202:
203: Press RETURN and the following screen appears:
204:
205: "Enter the unmounted local device and directory on that device where the distribution is located. [...]"
206:
207: Choose the following options:
208:
209: a: Device sd0a
210: b: File system ffs
211: c: Base directory
212: d: Set directory /sets
213:
214: Yes, "c: Base directory" is left empty, because we had copied the distribution .tgz files to the /sets directory on the Memory Stick (9.)
215:
216: Now continue with the installation as usual. Good luck!
217:
218:
1.7 ! wiki 219: ## Alternative Method
1.1 mspo 220:
221: 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.
222:
1.7 ! wiki 223: Extract the sets from the harddisk directly on to the Memory stick (/mnt):
1.1 mspo 224:
225: # tar xvfzp sets.tgz -C /mnt
226:
1.7 ! wiki 227: Extract the Kernel to the target root:
1.1 mspo 228:
229: # tar xvfzp GENERIC-kernel.tgz -C /mnt
230:
231: 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