Your first task is to allocate disk space for FreeBSD, and label that
space so that sysinstall can prepare it.
A D V E R T I S E M E N T
to do this you need to know how FreeBSD expects to find information on the
2.6.1 BIOS Drive Numbering
Before you install and configure FreeBSD on your system, there is an
important subject that you should be aware of, especially if you have
multiple hard drives.
In a PC running a BIOS-dependent operating system such as
Microsoft® Windows®, the BIOS is
able to abstract the normal disk drive order, and the operating system
goes along with the change. This allows the user to boot from a disk
drive other than the so-called “primary master”. This is especially
convenient for some users who have found that the simplest and cheapest
way to keep a system backup is to buy an identical second hard drive,
and perform routine copies of the first drive to the second drive using
XCOPY . Then, if the first drive fails, or is
attacked by a virus, or is scribbled upon by an operating system defect,
he can easily recover by instructing the BIOS to logically swap the
drives. It is like switching the cables on the drives, but without
having to open the case.
More expensive systems with SCSI controllers often include BIOS
extensions which allow the SCSI drives to be re-ordered in a similar
fashion for up to seven drives.
A user who is accustomed to taking advantage of these features may
become surprised when the results with FreeBSD are not as expected.
FreeBSD does not use the BIOS, and does not know the “logical BIOS drive
mapping”. This can lead to very perplexing situations, especially when
drives are physically identical in geometry, and have also been made as
data clones of one another.
When using FreeBSD, always restore the BIOS to natural drive
numbering before installing FreeBSD, and then leave it that way. If you
need to switch drives around, then do so, but do it the hard way, and
open the case and move the jumpers and cables.
Slices Using FDisk
Note: No changes you make at this point will be
written to the disk. If you think you have made a mistake and
want to start again you can use the menus to exit
sysinstall and try again or press
U to use the
Undo option. If you get confused and can not see how to
exit you can always turn your computer off.
After choosing to begin a standard installation in
sysinstall you will be shown this message:
In the next menu, you will need to set up a DOS-style ("fdisk")
partitioning scheme for your hard disk. If you simply wish to devote
all disk space to FreeBSD (overwriting anything else that might be on
the disk(s) selected) then use the (A)ll command to select the default
partitioning scheme followed by a (Q)uit. If you wish to allocate only
free space to FreeBSD, move to a partition marked "unused" and use the
[ OK ]
[ Press enter or space ]
Press Enter as instructed. You will then be
shown a list of all the hard drives that the kernel found when it
carried out the device probes.
Figure 2-13 shows an example from a system with two IDE disks. They
have been called ad0 and
Figure 2-13. Select Drive for FDisk
You might be wondering why ad1 is not
listed here. Why has it been missed?
Consider what would happen if you had two IDE hard disks, one as the
master on the first IDE controller, and one as the master on the second
IDE controller. If FreeBSD numbered these as it found them, as
ad0 and ad1 then
everything would work.
But if you then added a third disk, as the slave device on the first
IDE controller, it would now be ad1, and the
previous ad1 would become
ad2. Because device names (such as
ad1s1a) are used to find filesystems, you
may suddenly discover that some of your filesystems no longer appear
correctly, and you would need to change your FreeBSD configuration.
To work around this, the kernel can be configured to name IDE disks
based on where they are, and not the order in which they were found.
With this scheme the master disk on the second IDE controller will
ad2, even if there are no
ad0 or ad1
This configuration is the default for the FreeBSD kernel, which is
why this display shows ad0 and
ad2. The machine on which this screenshot
was taken had IDE disks on both master channels of the IDE controllers,
and no disks on the slave channels.
You should select the disk on which you want to install FreeBSD, and
then press [ OK ].
FDisk will start, with a display similar to that shown in
The FDisk display is broken into three
The first section, covering the first two lines of the display, shows
details about the currently selected disk, including its FreeBSD name,
the disk geometry, and the total size of the disk.
The second section shows the slices that are currently on the disk,
where they start and end, how large they are, the name FreeBSD gives
them, and their description and sub-type. This example shows two small
unused slices, which are artifacts of disk layout schemes on the PC. It
also shows one large FAT slice, which
almost certainly appears as C: in
MS-DOS / Windows,
and an extended slice, which may contain other drive letters for
MS-DOS / Windows.
The third section shows the commands that are available in
2-14. Typical Fdisk Partitions before Editing
What you do now will depend on how you want to slice up your disk.
If you want to use FreeBSD for the entire disk (which will delete all
the other data on this disk when you confirm that you want
sysinstall to continue later in the
installation process) then you can press A, which
corresponds to the Use Entire Disk
option. The existing slices will be removed, and replaced with a small
area flagged as unused (again, an artifact of
PC disk layout), and then one large slice for FreeBSD. If you do this,
then you should select the newly created FreeBSD slice using the arrow
keys, and press S to mark the slice as being
bootable. The screen will then look very similar to
Figure 2-15. Note the A in the
Flags column, which indicates that this slice
is active, and
will be booted from.
If you will be deleting an existing slice to make space for FreeBSD
then you should select the slice using the arrow keys, and then press
D. You can then press C, and
be prompted for size of slice you want to create. Enter the appropriate
figure and press Enter. The default value in this
box represents the largest possible slice you can make, which could be
the largest contiguous block of unallocated space or the size of the
entire hard disk.
If you have already made space for FreeBSD (perhaps by using a tool
such as PartitionMagic®)
then you can press C to create a new slice. Again,
you will be prompted for the size of slice you would like to create.
2-15. Fdisk Partition Using Entire Disk
When finished, press Q. Your changes will be
saved in sysinstall, but will not yet be
written to disk.
2.6.3 Install a Boot
You now have the option to install a boot manager. In general, you
should choose to install the FreeBSD boot manager if:
- You have more than one drive, and have installed FreeBSD onto a
drive other than the first one.
- You have installed FreeBSD alongside another operating system on
the same disk, and you want to choose whether to start FreeBSD or
the other operating system when you start the computer.
If FreeBSD is going to be the only operating system on this machine,
installed on the first hard disk, then the
Standard boot manager will suffice. Choose
None if you are using a third-party
boot manager capable of booting FreeBSD.
Make your choice and press Enter.
2-16. Sysinstall Boot Manager Menu
The help screen, reached by pressing F1,
discusses the problems that can be encountered when trying to share the
hard disk between operating systems.
2.6.4 Creating Slices
on Another Drive
If there is more than one drive, it will return to the Select Drives
screen after the boot manager selection. If you wish to install FreeBSD
on to more than one disk, then you can select another disk here and
repeat the slice process using FDisk.
Important: If you are installing FreeBSD on a drive
other than your first, then the FreeBSD boot manager needs to be
installed on both drives.
Figure 2-17. Exit Select Drive
The Tab key toggles between the last drive
selected, [ OK ], and
[ Cancel ].
Press the Tab once to toggle to the
[ OK ], then press
Enter to continue with the installation.
Creating Partitions Using Disklabel
You must now create some partitions inside each slice that you have
just created. Remember that each partition is lettered, from
a through to h, and
that partitions b, c,
and d have conventional meanings that you
should adhere to.
Certain applications can benefit from particular partition schemes,
especially if you are laying out partitions across more than one disk.
However, for this, your first FreeBSD installation, you do not need to
give too much thought to how you partition the disk. It is more
important that you install FreeBSD and start learning how to use it. You
can always re-install FreeBSD to change your partition scheme when you
are more familiar with the operating system.
This scheme features four partitions--one for swap space, and three
Table 2-2. Partition Layout
for First Disk
||This is the root filesystem. Every other filesystem will
be mounted somewhere under this one. 512 MB is a reasonable
size for this filesystem. You will not be storing too much
data on it, as a regular FreeBSD install will put about
128 MB of data here. The remaining space is for temporary
data, and also leaves expansion space if future versions of
FreeBSD need more space in /.
||2-3 x RAM
||The system's swap space is kept on the
b partition. Choosing the right
amount of swap space can be a bit of an art. A good rule of
thumb is that your swap space should be two or three times
as much as the available physical memory (RAM). You should
also have at least 64 MB of swap, so if you have less than
32 MB of RAM in your computer then set the swap amount to
If you have more than one disk then you can put
swap space on each disk. FreeBSD will then use each disk for
swap, which effectively speeds up the act of swapping. In
this case, calculate the total amount of swap you need
(e.g., 128 MB), and then divide this by the number of disks
you have (e.g., two disks) to give the amount of swap you
should put on each disk, in this example, 64 MB of swap per
||256 MB to 1024 MB
||The /var directory contains
files that are constantly varying; log files, and other
administrative files. Many of these files are read-from or
written-to extensively during FreeBSD's day-to-day running.
Putting these files on another filesystem allows FreeBSD to
optimize the access of these files without affecting other
files in other directories that do not have the same access
||Rest of disk (at least 2 GB)
||All your other files will typically be stored in
/usr and its subdirectories.
Warning: The values above are given as example and
should be used by experienced users only. Users are encouraged
to use the automatic partition layout called
Auto Defaults by the FreeBSD partition editor.
If you will be installing FreeBSD on to more than one disk then you
must also create partitions in the other slices that you configured. The
easiest way to do this is to create two partitions on each disk, one for
the swap space, and one for a filesystem.
Table 2-3. Partition Layout
for Subsequent Disks
||As already discussed, you can split swap space across
each disk. Even though the a
partition is free, convention dictates that swap space stays
on the b partition.
||Rest of disk
||The rest of the disk is taken up with one big partition.
This could easily be put on the a
partition, instead of the e
partition. However, convention says that the
a partition on a slice is reserved
for the filesystem that will be the root (/)
filesystem. You do not have to follow this convention, but
sysinstall does, so following it
yourself makes the installation slightly cleaner. You can
choose to mount this filesystem anywhere; this example
suggests that you mount them as directories
where n is a number that
changes for each disk. But you can use another scheme if you
Having chosen your partition layout you can now create it using
sysinstall. You will see this message:
Now, you need to create BSD partitions inside of the fdisk
partition(s) just created. If you have a reasonable amount of disk
space (200MB or more) and don't have any special requirements, simply
use the (A)uto command to allocate space automatically. If you have
more specific needs or just don't care for the layout chosen by
(A)uto, press F1 for more information on manual layout.
[ OK ]
[ Press enter or space ]
Press Enter to start the FreeBSD partition
editor, called Disklabel.
Figure 2-18 shows the display when you first start
Disklabel. The display is divided in to three
The first few lines show the name of the disk you are currently
working on, and the slice that contains the partitions you are creating
(at this point Disklabel calls this the
Partition name rather than slice name). This
display also shows the amount of free space within the slice; that is,
space that was set aside in the slice, but that has not yet been
assigned to a partition.
The middle of the display shows the partitions that have been
created, the name of the filesystem that each partition contains, their
size, and some options pertaining to the creation of the filesystem.
The bottom third of the screen shows the keystrokes that are valid in
Sysinstall Disklabel Editor
Disklabel can automatically create
partitions for you and assign them default sizes. The default sizes are
calculated with the help of an internal partition sizing algorithm based
on the disk size. Try this now, by Pressing A. You
will see a display similar to that shown in
Figure 2-19. Depending on the size of the disk you are using, the
defaults may or may not be appropriate. This does not matter, as you do
not have to accept the defaults.
Note: The default partitioning assigns the
/tmp directory its own partition
instead of being part of the /
partition. This helps avoid filling the /
partition with temporary files.
2-19. Sysinstall Disklabel Editor with Auto Defaults
If you choose to not use the default partitions and wish to replace
them with your own, use the arrow keys to select the first partition,
and press D to delete it. Repeat this to delete
all the suggested partitions.
To create the first partition (a, mounted as
/ -- root), make sure the proper disk slice at
the top of the screen is selected and press C. A
dialog box will appear prompting you for the size of the new partition
(as shown in
Figure 2-20). You can enter the size as the number of disk blocks
you want to use, or as a number followed by either M
for megabytes, G for gigabytes, or
C for cylinders.
Figure 2-20. Free Space for Root Partition
The default size shown will create a partition that takes up the rest
of the slice. If you are using the partition sizes described in the
earlier example, then delete the existing figure using
Backspace, and then type in 512M, as
Figure 2-21. Then press [ OK ].
Figure 2-21. Edit Root Partition Size
Having chosen the partition's size you will then be asked whether
this partition will contain a filesystem or swap space. The dialog box
is shown in
Figure 2-22. This first partition will contain a filesystem, so
check that FS is selected and press
Figure 2-22. Choose the Root Partition Type
Finally, because you are creating a filesystem, you must tell
Disklabel where the filesystem is to be
mounted. The dialog box is shown in
Figure 2-23. The root filesystem's mount point is
/, so type /, and
then press Enter.
Figure 2-23. Choose the Root Mount Point
The display will then update to show you the newly created partition.
You should repeat this procedure for the other partitions. When you
create the swap partition, you will not be prompted for the filesystem
mount point, as swap partitions are never mounted. When you create the
final partition, /usr, you can leave the
suggested size as is, to use the rest of the slice.
Your final FreeBSD DiskLabel Editor screen will appear similar to
Figure 2-24, although your values chosen may be different. Press
Q to finish.
2-24. Sysinstall Disklabel Editor