Use ZFS to create a filesystem hierarchy that deal efficiently with
disk space, archiving (through snapshot) and offer rollback
possibilities (for the upgrade process).
The layout that will be deployed will extensively use ZFS to
hierarchies filesystems and directories, this will facilitate backups,
snapshots and rollbacks thereafter, especially since ZFS can do this
recursively.
The file hierachy is splitted into four main categories:
Type
Description
base
the base system making FreeBSD
pkg
the applications installed from the packages or port mechanism
distrib
the FreeBSD sources (base system and port mechanism)
services
the data saved by the various services
The following ZFS hierarchy is proposed and can be adapted depending
on the type of installation wanted: base system on ZFS, services
(ldap, mysql, imap, …) installed. It is possible to do a lighter or
a deeper split, in all cases it will be relatively easy to change this
hierarchy on a running system, except for some of the
filesystems present on mount points of the base system (ie:
/, /usr, /var, …).
Filesystem
Mount point
Opt
Description
B
system/base
_Legacy: /
Roof of the operating system
a
system/base/tmp
/tmp
Directory for temporary files
s
system/base/usr
/usr
Applications of the base system
e
system/base/var
/var
Hold files which content is modified (log, lock, spoool, mail, …)
system/base/var/spool
/var/spool
Spool for task processing
system/base/var/tmp
/var/tmp
Directory for temporary files
system/base/var/empty
/var/empty
RO
Empty directory
system/base/var/log
/var/log
System log files
system/base/var/db
/var/db
Database used by applications (dhcp, ntpd, entropy, …)
P
system/pkg
/usr/local
Installed packages
k
system/pkg/etc
/usr/local/etc
Various configuration file for installed packages
g
system/pkg/db
/var/db/pkg
C
Information about installed packages
system/pkg/ports
/var/db/ports
C
Information about options chosen for packages compilation
D
system/distrib
none
A
Data for compiling/installing FreeBSD distribution and packages
i
system/distrib/src
/usr/src
C
Sources of the FreeBSD base distribution
s
system/distrib/ports
/usr/ports
C
Sources and infrastructure necessary for packages compilation
t
system/distrib/distfiles
/usr/ports/distfiles
Storage of “tarballs” containing the source applications
r
system/distrib/pkg
/usr/ports/packages
Storing compiled packages (from make package)
i
system/distrib/pkg/cache
/var/cache/pkg
Fetch packaged (see pkg (8))
b
system/build
/usr/obj
Intermediate data for distribution/ports compilation
system/build/cache
/var/cache/ccache
Used by ccache when compiling distribution/ports
S
system/services
none
Data saved by the various services (ie: ldap, mysql, …)
e
system/services/ldap
/var/db/openldap-data
Data for LDAP
r
system/services/mysql
/var/db/mysql
Data for MySQL
v
system/services/ftp
/var/ftp
Data for FTP
i
system/services/imap
/var/imap
Internal Cyrus IMAP management data
c
system/services/imap/mbox
/var/spool/imap
C
User mailboxes
e
system/services/imap/meta
/var/spool/imap-meta
Metadata for mailboxes
s
system/services/imap/sieve
/var/spool/sieve
User emails filtering rules
For some snapshots on empty filesystem will be created as an easy way
to purge the content if necessary (for example: cache, packages, …)
Purging content
1
zfs rollback filesystem@empty
Creation
Be careful to not enable a pool option that won’t be supported by
the bootloader.
Use of a dedicated pool for ZFS boot is advised, as all the ZFS
options are not supported by the bootloader.