Chapter 2. Installing NetBSD: Preliminary considerations and preparations

Table of Contents

2.1. Preliminary considerations
2.1.1. Dual booting
2.1.2. NetBSD on emulation and virtualization
2.2. Install preparations
2.2.1. The INSTALL* document
2.2.2. Hard disk geometries
2.2.3. Partitions
2.2.4. Hard disk space requirements
2.2.5. Network settings
2.2.6. Backup your data and operating systems!
2.2.7. Preparing the installation media
2.3. Checklist

2.1. Preliminary considerations

2.1.1. Dual booting

It is possible to install NetBSD together with other operating systems on one hard disk.

If there is already something on the hard disk, think how you can free some space for NetBSD; if NetBSD will share the disk with other operating systems you will probably need to create a new partition (which you will do with sysinst) and, maybe, to resize an existing one.

It is not possible to resize an existing partition with sysinst, but there are some commercial products (like Partition Magic) and some free tools (FIPS, pfdisk) available for this.

You can also install NetBSD on a separate hard disk.

Advise

We recommend to install NetBSD on its own, separate hard disk! This will avoid the risk to damage the existing operating system. Setting up a dual- or multi-boot system is a task for experienced users.

2.1.2. NetBSD on emulation and virtualization

With modern and powerful hardware it is possible to install and run NetBSD on top of other operating systems - without the cumbersomeness of dual booting. Emulators or virtualization environments provide a fast and secure way to try out NetBSD. The host operating system stays unchanged, and the risk to damage important data is limited.

This requires the correct setup of an emulation software or virtualization technology on the hosting operating system. That given, it is just at matter of creating a file-based image and using an install CD image to start with NetBSD.

Information about NetBSD as a Xen host and guest system is available on the NetBSD/xen web page

The NetBSD on emulated hardware web page provides detailed information about various emulators and the supported NetBSD platforms

2.2. Install preparations

2.2.1. The INSTALL* document

The first thing to do before installing NetBSD is to read the release information and installation notes in one of the INSTALL.* files: this is the official description of the installation procedure, with platform specific information and important details. It can be found in the root directory of the NetBSD release (on the install CD or on the FTP server):

  • ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-4.x/platform/INSTALL.html

It is advisable to print the INSTALL.* document out. It is available in various formats, usually .txt, .ps, .more and .html

2.2.2. Hard disk geometries

Note

You can do the install even if you don't know the hard disk geometry. In this case you have to trust sysinst, which automatically determines the geometry and (usually) gets it right.

It is sensible to be aware of geometry issues that may arise in relation to the used hard disk. First of all, you should know about sector size. You can count on this to be 512 bytes; other sizes are rare (and currently not supported). Of particular interest are the number of sectors per track, the number of tracks per cylinder (also known as the number of heads), and the number of cylinders. Together they describe the disk geometry.

The BIOS has a limit of 1024 cylinders and 63 sectors per track for doing BIOS I/O. This is because of the old programming interface to the BIOS that restricts these values. Most of the big disks currently being used have more than 1024 real cylinders. Some have more than 63 sectors per track. Therefore, the BIOS can be instructed to use a fake geometry that accesses most of the disk and the fake geometry has less than or equal to 1024 cylinders and less than or equal to 63 sectors. This is possible because the disks can be addressed in a way that is not restricted to these values, and the BIOS can internally perform a translation. This can be activated in most modern BIOSes by using Large or LBA mode for the disk.

NetBSD does not have the mentioned limitations with regard to the geometry. However, since the BIOS has to be used during startup, it is important to know about the geometry the BIOS uses. The NetBSD kernel should be on a part of the disk where it can be loaded using the BIOS, within the limitations of the BIOS geometry. The install program will check this for you, and will give you a chance to correct this if this is not the case.

If you have not yet installed any other systems on the hard disk that you plan to install NetBSD on, or if you plan to use the disk entirely for NetBSD, you may wish to check your BIOS settings for the `Large' or `LBA' modes, and activate them for the hard disk in question. While they are not needed by NetBSD as such, doing so will remove the limitations mentioned above, and will avoid hassle should you wish to share the disk with other systems. Do not change these settings if you already have data on the disk that you want to preserve!

In any case, it is wise to check the BIOS settings for the hard disk geometry before beginning the installation, and write them down. While this should usually not be needed, it enables you to verify that the install program determines these values correctly.

The geometry that the BIOS uses will be referred to as the BIOS geometry, the geometry that NetBSD uses is the real geometry.

sysinst, the NetBSD installation program, will try to discover both the real geometry and BIOS geometry.

It is important that sysinst know the proper BIOS geometry to be able to get NetBSD to boot, regardless of where on your disk you put it. It is less of a concern if the disk is going to be used entirely for NetBSD. If you intend to have several OSes on your disk, this becomes a much larger issue.

The installation program mentions two types of hard disk geometries:

  • real geometry

  • BIOS geometry

real geometry is the real geometry of the hard disk, detected by the system. BIOS geometry is the geometry used by the BIOS and it could be different from the real one (for example, BIOS could remap the disk using LBA).

The disk used in the installation example is an IDE disk with the following geometries:

real:  6232 cyl,   16 heads,  63 sec
BIOS:   779 cyl,  128 heads,  63 sec   (LBA)

As you can see the BIOS remaps the disk using LBA, effectively reducing the number of cylinders and increasing the number of tracks (but the result is the same: 6232 * 16 = 779 * 128 = 99712). A sector contains 512 bytes, which means that the disk size is 6232 * 16 * 63 * 512 = 3 GB. NetBSD does not need to remap the disk geometry (and in fact won't do it). During the installation it is possible to change manually the geometry if sysinst got it wrong.

2.2.3. Partitions

The terminology used by NetBSD for partitioning is different from the typical DOS/Windows terminology; in fact, there are two partitioning schemes. NetBSD installs in one of the four primary BIOS partitions (the partitions defined in the hard disk partition table).

Within a BIOS partition (also called slice) NetBSD defines its BSD partitions using a disklabel: these partitions can be seen only by NetBSD and are identified by lowercase letters (starting with “a”). For example, wd0a refers to the “a” partition of the first IDE disk (wd0) and sd0a refers to the “a” partition of the first SCSI disk. In Figure 2.1, “Partitions” there are two primary BIOS partitions, one used by DOS and the other by NetBSD. NetBSD describes the disk layout through the disklabel.

Figure 2.1. Partitions

Partitions

Note

The meaning of partitions “c” and “d” is typical of the i386 port. Other ports use different conventions (e.g. “c” represents the whole disk.)

Note

If NetBSD shares the hard disk with another operating system (like in the previous example) you will probably need to install a boot manager, i.e. a program which enables you to choose the OS to start at boot time. sysinst can do this for you and install and configure a simple but effective boot manager.

2.2.4. Hard disk space requirements

A fresh installed NetBSD system will take about 360 MB of disk space. Additional disk space will be needed for a swap partition, applications and for the users data.

2.2.5. Network settings

Write down the basic network settings. Especially if you plan to install over network via FTP or NFS you will need:

  • a free IP address for the network interface (for example: 192.168.1.11)

  • the Netmask (for example: 255.255.255.0)

  • the IP address of your default gateway (for example: 192.168.1.1)

  • and the IP address of the DNS server you use (for example: 145.253.2.75)

2.2.6. Backup your data and operating systems!

Before you begin the installation, make sure that you have a reliable backup of any operating systems and data on the used hard disk. Mistakes in partitioning your hard disk may lead to data loss. Already installed operating systems may become unbootable. "Reliable backup" means that the backup and restore procedure is tested to work faultless!

2.2.7. Preparing the installation media

The NetBSD installsystem consists of two parts. The first part is the installation kernel. This kernel contains the NetBSD install program sysinst and it needs to get booted from a CD (or DVD), Memory card, USB flash drive or from a floppy disk. The sysinst program will prepare the disk: it separates the disk space into partitions, makes the disk bootable and creates the necessary file systems.

The second part of the install system are the binary distribution sets, the files of the NetBSD operating system. The installer needs to have access to the distribution sets. sysinst can reach them via network (NFS server), internet (FTP server), on CDs/DVDs or on disks (with file systems that are supported by the installation kernel).

On big disks like CDs or memory cards, the install kernel and distribution sets can be stored together. The NetBSD Project provides those complete install media for every supported hardware architecture. They are available as bootable CD images (*.iso and *.iso.torrent files):

  • ftp://ftp.NetBSD.org/pub/NetBSD/iso/3.x

  • ftp://ftp.NetBSD.org/pub/NetBSD/iso/4.x

Note

Please see the mirrors list and choose a local server near you for downloads

2.2.7.1. Booting the install system from CD

To use a bootable NetBSD install CD download the *.iso file for your hardware architecture. Use the CD or DVD burning software on your actual operating system to create a bootable CD. Enable “Boot from CD-ROM” (or similar) in your BIOS settings, insert the CD and reboot the computer.

Refer to to the NetBSD Bootable CD ROM HOWTO, for all the details about the creation of installation CDs

2.2.7.2. Booting the install system from floppy

If you need to create installation floppies, you need to copy floppy images to a diskette. The floppy images are available on the NetBSD FTP servers or on a NetBSD install CD. To perform this operation in DOS you can use the rawrite program in the i386/installation/misc directory, for Windows there's a version in rawr32.zip. The image files are i386/installation/floppy/boot1.fs and i386/installation/floppy/boot2.fs for installation of a “normal” PC, and i386/installation/floppy/bootlap1.fs and i386/installation/floppy/bootlap2.fs for a laptop. A number of other floppies are available that are described in more detail in the INSTALL.* document.

Note

Before you create the installation disks on floppies, you should always check that the floppies are good: this simple step is often overlooked but it can save you a lot of trouble!

The procedure to write floppies is:

  1. Format the floppy.

  2. Go to the I386\INSTALLATION\FLOPPY directory of the CD-ROM.

  3. Run the ..\MISC\RAWRITE program (or extract ..\MISC\RAWR32.ZIP if you're on a Windows system, and run the RAWRITE32 program in that file). The “Source file”s are BOOT1.FS and BOOT2.FS (etc., see above) and the “Destination drive” is A:

To create the boot floppy in an Unix environment, the dd command can be used: For example:

# cd i386/installation/floppy
      # dd if=boot.fs of=/dev/fd0a bs=36b

dd copies blocks of 512 bytes: the bs=36b option copies 36 blocks at a time, effectively making the operation faster.

Note

A 1440K floppy contains 1474560 bytes and is made up of 80 cylinders, 2 tracks, 18 sectors and 512 bytes per sector, i.e. 80 * 2 * 18 = 2880 blocks. Thus bs=36b copies one cylinder (18 * 2 blocks) at a time and repeats the operation 80 times instead of 2880.

2.2.7.3. Booting the NetBSD install system via boot loader

An alternative to the creation of install CDs or floppies is the use of a boot loader, which is capable to boot NetBSD kernels. One example is the GNU GRUB boot loader. Any bootable disk with GRUB already installed will work: a hard disk with a Linux system, an USB flash drive, etc.

Apart from a disk with GRUB boot loader, some space is needed to store the NetBSD install kernel. The install kernel can be downloaded from one of the FTP mirrors:

  • ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-3.x/port/binary/kernel/netbsd-INSTALL.gz

  • ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-4.x/port/binary/kernel/netbsd-INSTALL.gz

The kernel file (netbsd-INSTALL.gz) needs to be un-zipped and saved into a directory. The distribution sets can also be stored into the directory, but this is optional as the sets can also be downloaded later via the sysinst installer. The (optional!) distribution sets are available in the sets directory:

  • ftp.NetBSD.org/pub/NetBSD/NetBSD-3.x/port/binary/sets/...

  • ftp.NetBSD.org/pub/NetBSD/NetBSD-4.x/port/binary/sets/...

In the following example, the install kernel is in the /data directory on the first partition of the second disk. The file system type on the drive is MSDOS FAT.The next step is to boot GRUB. When the boot menu appears, the “e” key needs to be pressed to get to the GRUB command line:

grub>
grub> find /data/netbsd-INSTALL
    (hd1,0)

The find command above is used to locate the install kernel: It is on the first partition (“0”) of the second disk (“hd1”). GRUB gets now instructed to boot the NetBSD kernel on disk “hd1,0”:

grub> root (hd1,0)
      Filesystem type is fat, partition type 0xb

grub> kernel --type=netbsd /data/netbsd-INSTALL

grub> boot
...

This will boot the NetBSD installation system.

2.3. Checklist

This is the checklist about the things that should be clear and on-hand now:

  • Geometry of the hard disk

  • Available disk space

  • Bootable medium with the install system

  • Disk or server with the distribution sets

  • A free IP address and the netmask

  • IP address of the default gateway

  • IP address of the DNS server

  • A working backup

  • Printout of the INSTALL.* document