Back up all important data on the target computer where FreeBSD will be installed. Test the backups before continuing. The FreeBSD installer will ask before making changes to the disk, but once the process has started it cannot be undone.
If FreeBSD will be the only operating system installed, and will be allowed to use the entire hard disk, the rest of this section can be skipped. But if FreeBSD will share the disk with other operating systems, an understanding of disk layout is useful during the installation.
Hard disks can be divided into multiple sections. These sections are called partitions.
There are two ways of dividing a disk into partitions. A traditional Master Boot Record (MBR) holds a partition table defining up to four primary partitions. (For historical reasons, FreeBSD calls primary partitions slices.) A limit of only four partitions is restrictive for large disks, so one of these primary partitions can be made into an extended partition. Multiple logical partitions may then be created inside the extended partition. This may sound a little unwieldy, and it is.
The GUID Partition Table (GPT) is a newer and simpler method of partitioning a disk. GPT is far more versatile than the traditional MBR partition table. Common GPT implementations allow up to 128 partitions per disk, eliminating the need for inconvenient workarounds like logical partitions.
Warning: Some older operating systems like Windows® XP are not compatible with the GPT partition scheme. If FreeBSD will be sharing a disk with such an operating system, MBR partitioning is required.
FreeBSD's standard boot loader requires either a primary or GPT partition. (See Chapter 13 for more information about the FreeBSD booting process.) If all of the primary or GPT partitions are already in use, one must be freed for FreeBSD.
A minimal installation of FreeBSD takes as little as 1 GB of disk space. However, that is a very minimal install, leaving almost no free space. A more realistic minimum is 3 GB without a graphical environment, and 5 GB or more if a graphical user interface will be used. Third-party application software requires more space.
A variety of free and commercial partition resizing tools are available. GParted Live is a free Live CD which includes the GParted partition editor. GParted is also included with many other Linux Live CD distributions.
Warning: Disk partition applications can destroy data. Make a full backup and verify its integrity before modifying disk partitions.
Resizing Microsoft® Vista partitions can be difficult. A Vista installation CDROM can be useful when attempting such an operation.
Example 3-1. Using an Existing Partition
A Windows computer has a single 40 GB disk that has been split into two 20 GB partitions. Windows calls them C: and D:. The C: partition contains 10 GB of data, and the D: partition contains 5 GB of data.
Moving the data from D: to C: frees up the second partition to be used for FreeBSD.
Example 3-2. Shrinking an Existing Partition
A Windows computer has a single 40 GB disk and one large partition using the whole disk. Windows shows this 40 GB partition as a single C:. 15 GB of space is being used. The goal is to end up with Windows in a 20 GB partition, and have another 20 GB partition for FreeBSD.
There are two ways to do this.
Back up your Windows data. Then reinstall Windows, creating a 20 GB partition during the install.
Use a partition resizing tool like GParted to shrink the Windows partition and create a new partition in the freed space for FreeBSD.
Disk partitions containing different operating systems make it possible to run any one of those operating systems at a time. An alternative method that allows running multiple operating systems at the same time is covered in Chapter 23.
Some FreeBSD installation methods need a network connection to download files. To connect to an Ethernet network (or cable or DSL modem with an Ethernet interface), the installer will request some information about the network.
DHCP is commonly used to provide automatic network configuration. If DHCP is not available, this network information must be obtained from the local network administrator or service provider:
Default router IP address
domain name of the local network
DNS server IP address(es)
Although the FreeBSD Project strives to ensure that each release of FreeBSD is as stable as possible, bugs occasionally creep into the process. On very rare occasions those bugs affect the installation process. As these problems are discovered and fixed, they are noted in the FreeBSD Errata on the FreeBSD web site. Check the errata before installing to make sure that there are no problems that might affect the installation.
A FreeBSD installation is started by booting the computer with a FreeBSD installation CD, DVD, or USB memory stick. The installer is not a program that can be run from within another operating system.
In addition to the standard installation media which contains copies of all the FreeBSD installation files, there is a bootonly variant. Bootonly install media does not have copies of the installation files, but downloads them from the network during an install. The bootonly install CD is consequently much smaller, and reduces bandwidth usage during the install by only downloading required files.
Copies of FreeBSD installation media are available at the FreeBSD web site.
Tip: If you already have a copy of FreeBSD on CDROM, DVD, or USB memory stick, this section can be skipped.
FreeBSD CD and DVD images are bootable ISO files. Only one CD or DVD is needed for an install. Burn the ISO image to a bootable CD or DVD using the CD recording applications available with your current operating system.
To create a bootable memory stick, follow these steps:
Acquire the Memory Stick Image
Memory stick images for FreeBSD 9.0-RELEASE and later can be downloaded from the ISO-IMAGES/ directory at ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/arch/arch/ISO-IMAGES/version/FreeBSD-version-RELEASE-arch-memstick.img. Replace arch and version with the architecture and the version number which you want to install, respectively. For example, the memory stick images for FreeBSD/i386 9.0-RELEASE are available from ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/i386/i386/ISO-IMAGES/9.0/FreeBSD-9.0-RELEASE-i386-memstick.img.
Tip: A different directory path is used for FreeBSD 8.X and earlier versions. Details of download and installation of FreeBSD 8.X and earlier is covered in Chapter 2.
The memory stick image has a .img extension. The ISO-IMAGES/ directory contains a number of different images, and the one needed depends on the version of FreeBSD being installed, and in some cases, the target hardware.
Important: Before proceeding, back up the data on the USB stick, as this procedure will erase it.
Write the Image File to the Memory Stick
Using FreeBSD to Write the Image
Warning: The example below shows /dev/da0 as the target device where the image will be written. Be very careful that the correct device is used as the output target, or you may destroy existing data.
Writing the Image with dd(1)
The .img file is not a regular file. It is an image of the complete contents of the memory stick. It cannot simply be copied like a regular file, but must be written directly to the target device with dd(1):
# dd if=FreeBSD-9.0-RELEASE-i386-memstick.img of=/dev/da0 bs=64k
Using Windows® to Write the Image
Warning: Be sure to give the correct drive letter as the output target, or you may overwrite and destroy existing data.
Obtaining Image Writer for Windows
Image Writer for Windows is a free application that can correctly write an image file to a memory stick. Download it from https://launchpad.net/win32-image-writer/ and extract it into a folder.
Writing the Image with Image Writer
Double-click the Win32DiskImager icon to start the program. Verify that the drive letter shown under Device is the drive with the memory stick. Click the folder icon and select the image to be written to the memory stick. Click [ Save ] to accept the image file name. Verify that everything is correct, and that no folders on the memory stick are open in other windows. When everything is ready, click [ Write ] to write the image file to the memory stick.
Note: Installation from floppy disks is no longer supported.
You are now ready to start installing FreeBSD.