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