Chapter 3: Advanced Installation Issues

In This Chapter

This chapter serves mostly as a supplement to Chapter 2, "Installing FreeBSD." If you wish to install FreeBSD on a system that already has another operating system on it, you will want to read this chapter before doing the installation. After you have completed the preinstallation tasks necessary for your situation, you should return to Chapter 2 and proceed with the normal installation.

Most often, you will install FreeBSD on a workstation that is already running Windows. This chapter shows how the two can operate side-by-side. We will also look briefly at installing on a system that is running Linux.

In addition, we will briefly cover NFS and FTP network installs.

Backing Up Existing Filesystems

Before you go any further, back up any existing filesystems that you want to maintain. Although the next section will show you how to nondestructively create space for FreeBSD, mistakes can still happen, and programs can cause errors. It is best to have a backup of anything you want to keep.


Caution

If you are not taking regular backups of your system, it is a good idea to get into the habit of doing so anyway. Hard disks are mechanical devices. They can and do fail sometimes. When they do, you will want a backup to restore your data from.


Media that can be used for backup purposes include recordable CDs, Zip or Jaz disks, tape drives, or—if the amount of data you need to save is small—floppy disks. Backing up the operating system and installed programs, such as word processing programs, are not necessary because they can be easily reinstalled. The primary things to worry about are your files containing data that cannot be easily replaced.

If you do not have an actual backup program, you can use an archiving program such as WinZip to help you compress data for backup and also to place that data onto disks.

The exact procedures for doing the backup are beyond the scope of this book. Please see the documentation for the program you plan to use for doing the backup for information on how to complete the backup.

Once you have backed up any existing files that you wish to keep, you will need to free up some space on your hard disk for installing FreeBSD. There are several ways that this can be done:

Nondestructive Hard Disk Partitioning with FIPS

FIPS is a program designed to run under DOS or Windows in DOS mode. It will split an existing DOS partition into two partitions at the point you specify. You can then use the new partition it creates as the space for FreeBSD. Note that FIPS works only with DOS-style partitions (FAT16 or FAT32). FIPS will not work with Windows NT/2000 NTFS partitions, nor will it work with Linux EXT2FS partitions. If you happen to be running OS/2, FIPS will not work with HPFS partitions, either.

FIPS has a couple of limitations that you need to be aware of:

If neither of the previous issues applies to you, and assuming you have made a backup, you are ready to begin the partitioning process.

Run Scandisk and Defragmenter

Before you use FIPS, you should run DOS or Windows Scandisk to fix any problems on the disk. After Scandisk has finished running, you will need to run the disk defragmenter.

FIPS needs contiguous free space at the end of the drive in order to split the partition. It cannot split before the last sector on the disk that contains data. Running the disk defragmenter moves all the data to the beginning of the disk without leaving holes in the middle.

Depending on the speed of your computer, the size of your hard disk, how fast the disk is, and how badly fragmented it is, the defragmentation process could take anywhere from a few minutes to several hours.

Obtaining FIPS and Creating a Boot Disk

Once the defragmentation process is finished, you are ready to start FIPS. FIPS is located on the included CD in the TOOLS directory with the name FIPS.EXE. You will also want the files named RESTORRB.EXE and ERRORS.TXT. You can also download FIPS from the FreeBSD ftp server at ftp.freebsd.org or one of its mirror sites in the directory /pub/FreeBSD/tools/fips.exe. Also, you will want the files restorrb.exe and errors.txt from the same directory.

You should create a bootable floppy, and copy the three files mentioned previously to it. In DOS or Windows, you can create a bootable floppy from a DOS prompt with the command format a: /s, assuming that you have a blank floppy in drive a. Following is a sample procedure to create the boot disk:

C:\> format a: /s
Insert new diskette in drive A:
and press ENTER when ready...

Checking existing disk format.
Verifying 1.44M
Format complete.
System transferred

Volume label (11 characters, ENTER for none)?

  1,457,664 bytes total disk space
   388,608 bytes used by system
  1,069,056 bytes available on disk

    512 bytes in each allocation unit.
    2,088 allocation units available on disk.

Volume Serial Number is is 031B-0831

Format another (Y/N)?n

C:\>d:
D:\>cd tools
D:\TOOLS>copy fips.exe a:\
  1 file(s) copied
d:\TOOLS>copy restorerb.exe a:\
  1 file(s) copied
D:\TOOLS>copy errors.txt a:\
  1 file(S) copied
D:\TOOLS>

Once you have done this, reboot your system from the floppy you just created. After the system has finished booting, type fips at the DOS prompt to start the FIPS program.

Working with FIPS

When FIPS first starts, it will give you a warning about not using it in a multitasking environment, among other things. Once you have read all the information, press any key to continue. If you have more than one hard disk in your system, FIPS will ask you which one you want to work on. Select the disk you want. FIPS will then show you the partition table of your disk. It will look something like the following:

     |        |      Start     |      |       End       | Start  |Number of|
Part.|bootable|Head Cyl. Sector|System|Head  Cyl. Sector| Sector |Sectors  | MB
-----+--------+----------------+------+----------------+--------+----------+----
1    |    yes |   1   0       1|   06h|  12  983      32|     32|   409312 | 199
2    |     no |   0   0       0|   00h|   0    0       0|      0|        0 |   0
3    |     no |   0   0       0|   00h|   0    0       0|      0|        0 |   0
4    |     no |   0   0       0|   00h|   0    0       0|      0|        0 |   0

Checking root sector ... OK

Press any Key

If you have more than one partition on your disk, FIPS will ask you which one you want to split. Select the partition you would like to split. If you only have one partition on your disk, you will simply be asked to Press any Key, as in the preceding example. After you have pressed a key to continue, FIPS will read the boot sector and present some more information on the disk:

Bytes per sector: 512
Sectors per cluster: 8
Reserved sectors: 1
Number of FATs: 2
Number of rootdirectory entries: 512
Number of sectors (short): 0
Media descriptor byte: f8h
Sectors per FAT: 200
Sectors per track: 32
Drive heads: 13
Hidden sectors: 32
Number of sectors (long): 409312
Physical drive number: 80h
Signature: 29h

When FIPS has finished presenting information, you will be asked to choose the starting cylinder for the new partition. The size of the new partition and the size of the old partition are presented. Use the left and right arrow keys to decrease and increase the number that the new partition will start on. In addition, you can use the up and down arrow keys to increase and decrease the size of the new partition in increments of 10 cylinders. When you have finished, press Enter to continue.


Tip

Write down the starting cylinder information for the new partition that you create. This will help you verify later on during the FreeBSD install that you have selected the correct partition to install FreeBSD on.


Once you have pressed Enter, FIPS will show you what the new partition table will look like. You will then be given the option to re-edit the partition table, or continue. If you select Continue, FIPS will ask you one last time if you are sure you want to write the changes to the partition table. Selecting y will cause FIPS to write the changes and then exit. At this point, you need to reboot your system.

If FIPS exited with any errors see the "Troubleshooting FIPS Problem" section at the end of this chapter.


Caution

It is very important that you do NOT write anything to the hard disk until after you have rebooted. Doing so could corrupt the disk since DOS will not be aware that the partition table has changed until the system has been rebooted.


Once you have rebooted, you should run FIPS again with the -t option. This will check to make sure that the partition was split correctly. If errors are reported, restore the previous partition table by running RESTORRB.EXE and then reboot again.


Caution

Once you have made ANY changes to the filesystems on the disk, you will no longer be able to use RESTORRB.EXE to restore the old partition table. Therefore, it is very important that you run fips with the -t option after you reboot before you do anything else.


If fips -t doesn't report any errors, remove the floppy from the drive, and reboot. When Windows or DOS has finished restarting you should run Scandisk on the partition you split to check for any errors.

Potential Problems with and Limitations of Dual Boot Systems

It is possible to have a dual boot system in which you can have two (or even more) operating systems on the hard disk, and you can select which one you want at each system boot. There are some potential problems that you need to be aware of when doing this, though.

The first one is that all of the information necessary to boot FreeBSD must be located within the first 1024 cylinders of the hard disk. This means that either the root partition must be completely located within the first 1024 cylinders, or you can use a separate boot partition that is completely located in the first 1024 cylinders. If you choose this option, the root partition does not have to be completely located in the first 1024 cylinders. Note that "completely located" means that the partition has to both start and end below the 1024th cylinder. Simply starting below the 1024th cylinder is not good enough.

If you need more space for Windows or DOS than is available below 1024 cylinders, you will need to split the Windows or DOS partition into two partitions, giving you a C drive and a D drive in Windows or DOS. In between these C and D drives, you will need to put a small partition for FreeBSD to boot from. This partition will be used as /boot later on during the install. 30 megabytes should be more than enough for this partition.

The second thing to be aware of if you will be reinstalling everything is that you should install DOS or Windows before you install FreeBSD. DOS and Windows assume that they are the only operating system on the hard drive, and will overwrite the master boot record without asking. If you install FreeBSD first, installing DOS or Windows later will clobber FreeBSD's boot manager, and you will no longer be able to boot into FreeBSD. This problem is easily fixed, but save yourself the headaches, and just install DOS or Windows first.

Dual Booting with DOS, Windows 95, Windows 98, or Windows ME

FreeBSD comes with a boot manager that will allow you to dual boot with various operating systems. If you already have DOS, Windows 95, Windows 98, or Windows ME installed, it is easy to set up the boot manager. You will be given the option to install it during the FreeBSD installation. DOS, Windows 95, Windows 98, or Windows ME will automatically be added to the boot menu.

Dual Booting with Linux

If you wish to dual boot with Linux and load Linux from the FreeBSD boot manager, install LILO at the beginning of your Linux boot partition rather than in the MBR. See the LILO documentation for instructions on how to do this. After you have done this, you will be able to boot Linux from the FreeBSD boot manager. If you wish to boot FreeBSD from LILO, please see the section later in this chapter titled "Booting FreeBSD from LILO," later in this chapter.

The FreeBSD Boot Manager

The FreeBSD boot manager can be installed during the installation to allow you to boot multiple operating systems. After the install, the boot manager can be configured with the boot0cfg program.

boot0cfg is command-line driven. Fortunately, you probably do not need to be concerned with most of the options. There are a couple of options that you might be interested in, though.

boot0cfg -B will install the boot manager onto the hard disk's MBR. This is one way to restore the boot manager if Windows should wipe it out. Of course, you would have to boot from a FreeBSD boot disk to use this if the boot manager had been wiped out. In addition, if you wish to make changes to the boot manager configuration, you will need to reinstall it using this command, followed by the changes you wish to make. The following list (see Table 3.1) of options is supported for making changes to the boot manager configuration:

Table 3.1 Boot Manager Configuration Options

Option

Description

-v

boot0cfg will be more verbose about what it is doing.

-b image

Where image is the name of the boot image to use. The default is /boot/boot0.

-d drive

Where drive is the drive number used by the PC's BIOS for referencing the disk. Usually this is 0x80 for the first drive, 0x81 for the second, and so on.

-f file

Where file is the name of a file that the original MBR should be backed up to in case there are problems. If the file already exists, it will be truncated.


The -o option is also supported and it contains a comma-separated list of options. Here are some of the options:

Table 3.2 Boot Manager Configuration Options

Option

Description

packet

If the PC's BIOS supports it, this will tell boot0cfg to use int 0x13 extensions instead of CHS for disk IO. This will get around the 1024 cylinder boot limit described previously. However, if the PC's BIOS does not support this option, it may cause the system to hang on the next reboot.

noupdate

By default, the boot manager can write to the MBR and update it (to set the active flag, etc). This can cause problems if you have hardware antivirus support enabled that prevents writing to the MBR and such. The noupdate option will prevent the boot manager from attempting to write to the MBR.


boot0cfg also supports the -s n option, where n is a number from 1 to 5 that specifies the default slice (commonly referred to as partitions in MS-DOS/Windows) to boot if no selection is made. The -t n option is also supported, where n is a number representing the number of "ticks" to wait before booting the default operating system. There are approximately 18.2 ticks in a second.

Booting FreeBSD from LILO

If you are running Linux and want to boot FreeBSD from Linux's LILO, it is fairly easy to do.

In Linux, edit the file /etc/lilo.conf, and add the following lines:

other=/dev/hda2
  table=/dev/hda
  label=FreeBSD

You will need to change the other line to reflect whatever device Linux recognizes your FreeBSD drive as.

After you have changed the configuration file, you will need to reinstall LILO by typing lilo as the root user.

Alternate Installation Methods

If you can't, or (for whatever reason) don't want to install FreeBSD from the CD included with this book, there are several other options available. These include network installs with FTP or NFS.

Installing FreeBSD over FTP

FTP stands for File Transfer Protocol. It is one of the earliest methods of transferring files over the Internet from one system to another. FTP is still widely used.

If you wish, you can install FreeBSD directly from an FTP server. If you want to do this, however, it is recommended that you have a full-time, fast Internet connection available. Doing an FTP install over a modem will take a very long time.

The first thing you need to determine if you want to do an FTP install is whether you can log in to the FTP server using the username anonymous. This is a common way of logging into public FTP servers. If you will be installing FreeBSD from the FreeBSD sites or one of the official mirrors, you can log in as anonymous. In this case, you can skip the next section. If however, you will be installing from an FTP server that does not allow anonymous logins (such as an internal FTP server on a LAN), you will need to follow the procedures in the next section to configure the username first.

Configuring the Username

From the sysinstall main menu (see Figure 3.1), arrow down to Options and press Enter. This will bring you to the screen shown in Figure 3.2.

Figure 3.1
The FreeBSD sysinstall main menu.

Figure 3.2
The Options menu, in which you can set the FTP login name.

In this screen, arrow down to the option that says FTP Username and press the spacebar. A dialog box will ask you to enter the username. Enter the name you need to use to log in to the FTP server and press Enter. You will then be asked to supply a password. Enter the password you need to use and press Enter again.

After you have finished, press Q to quit, and you will be returned to the Main sysinstall menu.

Selecting an FTP Install

After you have set the FTP username and password (if necessary), follow the instructions in Chapter 2 until you get to the screen where you are asked to Choose Installation Media. From this screen, select FTP or FTP Passive if the server you intend to install from is behind a firewall. (Ask your system administrator if you are not sure). You will then be asked to select a distribution site (see Figure 3.3).

Figure 3.3
Selecting the FTP server to install FreeBSD from.

If you are installing from one of the FreeBSD mirror sites, you can select the site from the list. Otherwise, select URL to specify an FTP server manually. In the dialog box that comes up (see Figure 3.4), you will be asked to specify the name of the FTP server, as well as the path to where the FreeBSD installation files are located. Figure 3.4 shows a sample for an ftp site with a hostname of lion located on the network samplenet.org, with the FreeBSD files located in the /FreeBSD directory.

Figure 3.4
Configuring the FTP server to install from.

Once you have configured the FTP server you wish to install from, you will need to configure the network (see Figure 3.5).

Figure 3.5
Configuring the network.

Follow the procedure in Chapter 2 under the "Configuring the Network" heading for instructions on how to do this.

Once you have finished configuring the network, the installation continues as in Chapter 2. When files have finished copying, you can go ahead with the "Post Installation" section of Chapter 2. Because you have already configured the network to do the installation, you can skip the network configuration portion.

Note that this chapter has covered only how to install FreeBSD from an FTP server. If you want to set up an "Installation server" that can be used by clients to install FreeBSD, see Chapter 27, "Configuring an FTP Server." Once you have an FTP server set up and the FreeBSD installation files available on it, you can have other systems install from it using the procedures in this chapter.

Doing an NFS Install

NFS stands for Network File System. It is a way for filesystems located on a server to be accessed by the local system. FreeBSD can be installed over NFS, assuming that there is an NFS server on your network that has the installation files available.

If your NFS server will work only on a secure port (or if you have a slow Ethernet adapter, follow the procedure in the following section. Otherwise, you can skip the next section.

Configuring sysinstall for a Secure Port or Slow Connection

At the sysinstall Main Menu (shown previously in Figure 3.1), select Options and press Enter. This will bring up the screen shown previously in Figure 3.2. The first option is NFS Secure. If your NFS server only works on a secure port (ask your system administrator) press the spacebar to toggle this to Yes. The second option (NFS Slow) should be toggled to Yes if you have a slow Ethernet card. Once you have made these changes, press Q to return to the sysinstall Main Menu.

Installation then continues, as discussed in Chapter 2, up to the point where you are asked to Choose Installation Media.

Selecting an NFS Install

At the Choose Installation Media screen, select NFS. You will then be asked to enter the name of the NFS server followed by the path where the FreeBSD installation files are located. In the example in Figure 3.6, the server is lion and the installation directory is install/FreeBSD.

Figure 3.6
Configuring an NFS server for installation.

Once you have entered this information, you will need to configure the network (shown previously in Figure 3.5). Follow the procedure shown in Chapter 2 under the "Configuring the Network" heading for instructions on how to do this.

Once you have finished configuring the network, the installation continues as discussed in Chapter 2. When files have finished copying, you can go ahead with the "Post Installation" section of Chapter 2. Because you have already configured the network to do the installation, you can skip the network configuration portion.

Note that this chapter has covered only how to install FreeBSD from an NFS server. If you want to set up an Installation server that can be used by clients to install FreeBSD over NFS, see Chapter 31, "The Network Filesystem (NFS)." Once you have an NFS server set up and the FreeBSD installation files available on it, you can have other systems install from it using the procedures discussed in this chapter.