This paper describes how to encrypt a file system on FreeBSD using GELI with 448bit Blowfish encryption. See the GELI(8), MDCONFIG(8) and NEWFS(8) manual pages for more detailed description of the commands and parameters.
This example will use a memory disk, however if you're using a physical disk then skip step 1. and substitute /dev/md0 with your disk's DSF.
If a memory disk is to be used then this needs to be created first. The following commands create a 10GB file and then a vnode DSF /dev/md0:
The first step in creating an encrypted file system is to generate an encryption key. The following creates a 448 bit key:
The disk is then initialised using the above encryption key (plus a few other parameters; 4K block size, Blowfisk Encryption, 448 bits) and a password:
This next step must be performed everytime you want to mount the disk. It basically tells the kernel module to link the key with the disk:
If the disk has just been initialised then a new file system must be created prior to mounting:
Finally, mount the encrypted file system as per any normal file system with the exception of keying in the password:
To mount manually after each boot steps 1 (if applicable), 4 and 5 are necessary.
For more information on setting up encrypted file systems to automatically boot see GELI(8).