Appendix B. Installing without sysinst

Table of Contents
B.1. Theory of partitioning and installation process
B.2. Installation in practice

This appendix has been contributed by Wojciech Puchar

This appendix is intended to help installing NetBSD version 1.5.2 without it's sysinst utility. You may ask why not to use this tool. Here are some possible reasons:

This appendix covers only i386 machines on which NetBSD will be the only OS on drive. I just haven't enough almost on other cases to write about. However I tried to mark every i386-specific fragments and any contribution are welcome (including fixes to my poor english) by mail to wojtek@3miasto.net.

Basic Unix knowlege (about what is cd, ls, cp, tar) is required.

B.1. Theory of partitioning and installation process

The installation process consist of 5 parts:

  1. partitioning target disk

  2. making filesystem(s)

  3. installing the bootloader (platform-specific, no-op on sparcs, shark etc..)

  4. decompressing the distibution files to the target partition.

  5. final configuration (making /dev nodes, /etc/fstab, setting hostname etc..)

B.1.4. Filesystems

NetBSD generally uses a filesystem called "ffs" or "ufs" (Fast File System or Unix File System). While "fast" is not "the fastest in the world" it is good for general use, and has mechanisms that protect its consistency on crashes. While just using the "newfs" command without special parameters will do the job, it's really worth to optimize it. Here is short description of the parameters worth modyfying:

The options that I use for >10GB partition are

newfs -m 5 -b 8192 -f 1024 -i 32768 /dev/{partition_name}

Please do read manual of newfs sometime.

B.2. Installation in practice

In every example I assume your disk drive is named wd0 in NetBSD, your CD drive (if present) cd0 and your ethernet card ep0 (if you have.) If the actual names are different just replace them in the examples.

B.2.3. Using disklabel to create partitions

# disklabel -I -i wd0

This will begin partitioning/labeling on clean drive. Don't type -I if you want to modify existing labels.

You will see prompt:

partition> 

Ready for your commands. The most important commands are ? (help), I (setting general disk information) and lowercase a to h (setting partition info for partition a, b, c, ..., h).

Begin with I. You will be asked for disk type (accept the default), disk name (same), and label name. In label name type whatever you want, but writing your name is useful. If someone steals your drive and will be found you can show it's yours. DOS/Windows fdisk won't wipe this.

Number of partitions: select 8 or more if you really need more. Leave defaults for the other options as all geometry infos are fake for modern drives.

Now you have to create partitions. begin with partitions d and c pointing to whole drive:

partition> d
Filesystem type [?] [unused]: 
Start offset [0c, 0s, 0M]: 0s
Partition size ('$' for all remaining) [39693.8c, 40011300s, 19536.8M]: $
partition> c
Filesystem type [?] [unused]: 
Start offset [0c, 0s, 0M]: 0s
Partition size ('$' for all remaining) [39693.8c, 40011300s, 19536.8M]: $

Then create the partition you want to place at the beginning of the disk. In the classic Unix partitioning it will be partition "a" for about 50MB. Make it larger if you intend to have lots of mail in spool or other things in /tmp or /home and you don't make a separate /var or /home partition.

partition> a
Filesystem type [?] [unused]: 4.2BSD
Start offset [0c, 0s, 0M]: 0s
Partition size ('$' for all remaining) [0c, 0s, 0M]: 100000s

100000 sectors will be about 50MB (a little less.)

Then second (swap) of about 585MB:

partition> b
Filesystem type [?] [unused]: swap
Start offset [0c, 0s, 0M]: 100000s
Partition size ('$' for all remaining) [0c, 0s, 0M]: 1200000s

and then the partition for /usr (e) till the end of drive:

partition> e
Filesystem type [?] [unused]: 4.2BSD
Start offset [0c, 0s, 0M]: 1300000s
Partition size ('$' for all remaining) [0c, 0s, 0M]: $

Now use P to check you did everything right:

partition> P
8 partitions:
#        size   offset     fstype   [fsize bsize cpg/sgs]
  a:   100000        0     4.2BSD        0     0    0   # (Cyl.    0 - 99*)
  b:  1200000   100000       swap                       # (Cyl.   99*- 1289*)
  c: 40011300        0     unused        0     0        # (Cyl.    0 - 39693*)
  d: 40011300        0     unused        0     0        # (Cyl.    0 - 39693*)
  e: 38711300  1300000     4.2BSD        0     0    0   # (Cyl. 1289*- 39693*)

Now type:

partition> W
Label disk [n]? y
Label written
partition> Q

to finally write your disklabel. Congratulations - the most difficult part is over!

B.2.5. Decompressing the installation files

Mount your partitions at /mnt:

# mount -o async,noatime /dev/wd0a /mnt
# mkdir /mnt/usr
# mount -o async,noatime /dev/wd0e /mnt/usr
...
maybe more if you created more
...

Options async and noatime aren't mandatory. They just favor the speed of the filesystem over safety. Crash protection isn't important now as you can wipe it again in case of crash.

The following sections describe some common installation methods:

CDROM
FTP
NFS

B.2.5.4. Installing from tape

While desktop machines usually have no tape drives, servers usually do, and may not contain a CDROM drive just to waste space. Installing from tape is very easy; unfortunately PCs cannot boot from tape so you must boot from floppies.

To prepare your install tape you need to do this on another machine with a tape drive.

Rewind tape:

# mt rewind

set unlimited block size for SCSI tapes

# mt setblk 0

This will change the default very small block size to any size. We will use large blocks to make things fast. It's useful for DAT/DDS drives.

!!!WARNING!!! Please correct me if this won't work for other tape types.

Now turn off compression, as different target drives may be unable to read a compressed stream. Compressing already compressed files will give no improvement anyway, or even negative compression rates (up to -15% for HP DDS drives!):

# mt compression 0

then record distribution files:

# cd /where_are_distribution_files
# tar -b64 -cvf /dev/nrst0 *.tgz

The last command will write all tgz files to tape with a block size of 64*512 bytes=32 kB. This is a well tested block size for every DAT.

As you use /dev/nrst0 (non-rewinding first SCSI tape drive) you can now record another archive with, for example, some basic packages like editors.

# cd /where_are_packages/All
# tar -b64 -cvf /dev/nrst0 joe*.tgz screen*.tgz

This will record only the joe text editor and the screen program. Don't put too many things on this file.

Now record other packages you will install after having system working multiuser.

# tar -b64 -cvf /dev/nrst0 all_packages_you_will_need

or maybe even

# tar -b64 -cvf /dev/nrst0 *.tgz

Now rewind and unload tape:

# mt rewoffl

Your install tape is ready! As DDS drives are backward compatible it may be handy to buy some used DDS-1 or DDS-2 tape drive cheaply for your home machine. You will be able to prepare such tapes, and of course to backup your home computer. It's really nice thing - worth $30 for me :)