Partitions and Slices

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).

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.

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.".