Ok, since I am reading Michael Lucas' FreeBSD Mastery: Storage Essentials I decided to get my hands dirty and learn about GELI and disk encryption. Here are my notes:
First of all, you need a new device to encrypt, you can encrypt existing devices, but you need to backup data first. I assume too that you have GELI up and running.
- Randomizing the device.
We want our device to be filled by randomness, so we apply three teaspoons of it:
I went the easy way and encrypted without a key file, this is NOT RECOMMENDED, so create your key file. (You can find how in the book :) )dd if=/dev/random of=/dev/ada0p1 bs=1m
- Initializing the provider.
You will receive the next message:geli init -s 4096 /dev/ada1p1
Metadata backup can be found in /var/backups/ad1p1.eli and can be restored with the following command:
# geli restore /var/backups/ada1p1.eli /dev/ada1p1
- Activate the device.
Ok now you have your device ready, let's create a new filesystem on it and mount it:geli attach /dev/ada1p1
newfs -j /dev/ada1p1.eli
Done? Ok now unmount and detach it.mount /dev/ada1p1.eli /mnt/
Groovy!geli detach ada1p1.eli