Many Unix users are also (or have been) Windows users. Some more technically savvy Windows users will be aware of the Microsoft method of disk partitioning. For a refresher, see Partitioning Theory.
However, when such users start using FreeBSD or other open source distros, the concept of Partitions is slightly different and also includes the term 'Slices'.
This new paradigm can sometimes lead to confusion, stress, headaches and even death, in the case of the more severe hardcore stress-heads. If this is you, then read on dear reader..
A quick reminder of the Microsoft modus operandi then. You get up to four Primary Partitions, presumably for multi-booting several Operating Systems. If you require a few Logical Drives for data storage, then that limits you to three Primary partitions and one Extended Partition.
FreeBSD needs one of the four entries in the partition table on the hard drive and can be multi-booted thus..
The FreeBSD Primary Partition is called a
Slice in FreeBSD terminology. The
disklabel program is then used to create up to eight partitions in this Primary Partition. These logical partitions are called
Partitions in FreeBSD talk..

This concept is similar to the way Linux and DOS handle Logical Drives in an Extended Partition. You cannot install FreeBSD in an Extended Partition made by Linux (or DOS).
The FreeBSD labelling scheme is an adaption of the traditional BSD labelling style, ported to live within the PC's fdisk partitions. Thus it is very similar to other BSD-based Unix systems such as NetBSD, OpenBSD, Ultrix, Digital Unix, SunOS, and Solaris.
Vewing disk and partition info
There are several commands under FreeBSD which can be used to view the configuration of the hard disk (and other file systems).
more /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b none swap sw 0 0
/dev/ad0s1a / ufs rw 1 1
/dev/acd0 /cdrom cd9660 ro,noauto 0 0
I usually perform this command first to get an idea of what slices and file systems are present on the FreeBSD system. Note that just like all system devices, the partitions appear in the
/dev directory. The first partition (the root partition) is
/dev/ad0s1a.
The swap partition is
/dev/ad0s1b. If more partitions were present, they would follow this same pattern. The CD-ROM or DVD is
/dev/acd0.
Run the
man fstab command for more information about this utility.
df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 8.5G 7.1G 737M 91% /
devfs 1.0K 1.0K 0B 100% /dev
The
df command outputs the Disk Free space: very useful for discerning how much space has been used on disk. Run the
man df command for more information about this utility.
fdisk
/dev/ad0: 19386 cyl 16 hd 63 sec
Part Start Size Type Flags
1: 63 19541025 0xa5 0x80
[root@franga] $fdisk
******* Working on device /dev/ad0 *******
parameters extracted from in-core disklabel are:
cylinders=19386 heads=16 sectors/track=63 (1008 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=19386 heads=16 sectors/track=63 (1008 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 19541025 (9541 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 1023/ head 15/ sector 63
As can be seen, the
fdisk command outputs a shitload of information; more than most people would ever need to know about their filesystem.
From the
man page..
"The FreeBSD utility, fdisk, serves a similar purpose to the DOS utility. The first form is used to display slice information or to interactively edit the slice table. The second is used to write a slice table using a configfile, and is designed to be used by other scripts/programs.".
Run the
man fdisk command for more information about this utility.
References and Further Reading
http://www.onlamp.com/pub/a/bsd/2002/06/27/Big_Scary_Daemons.html
- A.