16501
![]() |
|
|
|
|
|||||||
| Howtos & FAQs (Moderated) Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Warning: the following howto will wipe your disk and delete all data on it! Be safe. Make backups first. Or use VirtualBox to test it first!
I've found a nice howto on how to install FreeBSD with full disk encryption on ZFS. This could a good choice for laptops where security is important. The ZFS on top of ELI makes the filesystem resilient against crashes (power cut or whatever), and it gives you a range of nice options to use! No more fsck after a ungraceful shutdown. Snapshots. To name a few. The basis steps are: ** From sysinstall, follow your basic FreeBSD installation scenario, making these slices: Code:
ad0s1a / (2GB) ad0s1b swap (2GB) ad0s1d /space (the rest) ** Once booted, free up your ad0s1b, and copy the current root partition (ad0s1a) on to it Code:
# swapoff -a # newfs /dev/ad0s1b # mount /dev/ad0s1b /mnt # cd / # tar cf - --one-file-system * | tar xpf - -C /mnt Before: Code:
/dev/ad0s1b none swap sw 0 0 Code:
/dev/ad0s1b / ufs rw 1 1 ** Now reboot again. At the bootloader, press space, and boot from the b-slice by entering: Code:
0:ad(0,b)/boot/loader Now we can start the ELI/ZFS configuration on the largest part of the disk (ad0s1d). Code:
# geli init -b -v -s 4096 /dev/ad0s1d The -b causes eli to ask for the passphrase upon boot, when the kernel module is loaded by /boot/loader.conf. Code:
# geli attach ad0s1d We should now have a crypted ad0s1d.eli available (try 'geli list'). From this disk we create a ZFS pool: Code:
# zpool create tank ad0s1d.eli Code:
# newfs /dev/ad0s1a # mkdir /tank/bootdir # mount /dev/ad0s1a /tank/bootdir # cp -Rp /boot /tank/bootdir/ # ln -sf /tank/bootdir/boot /tank/boot ** Edit /tank/boot/loader.conf to contain the following: Code:
zfs_load="YES" geom_eli_load="YES" hint.kbdmux.0.disabled=1 ** Create /tank/bootdir/etc/fstab so the kernel knows what fs to mount the root from: Code:
# mkdir /tank/bootdir/etc # vi /tank/bootdir/etc/fstab Code:
tank / zfs rw 0 0 Code:
tank / zfs rw 0 0 /dev/ad0s1a /bootdir ufs rw 1 1 ** Now tell ZFS to prevent from re-mounting tank as it will be used for the root filesystem: Code:
zfs set mountpoint=legacy tank That's it. Reboot, and your done. Fixing /boot: I haven't figured this out yet, but as said your kernel (/boot) comes from ufs:ad0s1a. This means that once your booted, /boot should actually point to ad0s1a somehow, or kernel updates will never work. To do this, I did, once booted, assuming ad0s1a is mounted in /bootdir: Code:
cd / rm -rf boot (you now remove the boot from the zfs pool that is never used anyway) ln -s bootdir/boot . Just always check that /boot/loader.conf (so actually that it ufs:ad0s1a/boot/loader.conf) is there and that eli and zfs are loaded there, otherwise you will not be able to boot. Last edited by DutchDaemon; March 21st, 2010 at 16:04. Reason: added proper formatting |
| The Following User Says Thank You to frijsdijk For This Useful Post: | ||
dbi (March 21st, 2010) | ||
|
#2
|
|||
|
|||
|
Pros: Encryption is great for laptops and other devices that can easily be lost/stolen.
I have some questions about possible cons, though. 1. Could you, please, share some info on the performance impact of GELI under ZFS? 2. Wouldn't putting GELI layer under ZFS break the self-healing and data integrity features of ZFS? |
|
#3
|
||||
|
||||
|
1) works fine for me on my Desktop PC
2) Haven't tested self healing |
|
#4
|
|||
|
|||
|
There will be a performance hit, for sure. But performance is not the main focus here, data security is. I have been running FreeBSD 7.2 on my laptop a while back, on which at that time swap, /tmp, /var and /home were ELI crypted, but I wasn't running ZFS on top of it but GJOURNAL. Only my /usr wasn't crypted. But I've heard that data can actually end up anywhere on your disk, even if it's temporary. If data security is paramount, the whole disk should be crypted.
In my example, actually /bootdir should in the end probably not be mounted at all, or be mounted read-only and only be made writable/available if you're updating a kernel. |
|
#5
|
|||
|
|||
|
OK, I agree that if data security is paramount, the speed doesn't matter so much, but in that case data integrity is of big importance too.
My understanding is that ZFS has the ability to provide applications with correct data even if the underlying device returns corrupted data (e.g. data was written in a sector that went "bad"). If the checksum doesn't match, ZFS gets the data from elsewhere e.g. from another disk in case of mirroring, from a different location (zfs set copies=N) or reconstructs it from other raid-z chunks. Along with passing the correct data ZFS corrects the on-device error. Hence the term "self-healing" [1]. So, the question is will ZFS loose its self-healing abilityif if it is NOT residing directly on the block device? [1] http://2007.asiabsdcon.org/papers/P16-slides.pdf, pages 9-11 Please, note the "zfs slides presentation" is by Mr. Pawel Jakub Dawidek, not some random web source. Last edited by dbi; March 21st, 2010 at 21:53. |
|
#6
|
|||
|
|||
|
I can't really answer that. I would say that it doesn't providing we have a mirror or N > 1. Doesn't a .eli device act just like a block device?
I don't have a full understanding of the underlying layers and techniques to give a proper answer here.. |
|
#7
|
|||
|
|||
|
frijsdijk, please, don't feel like you have to give all the answers. It's just that your very nice how-to brought an interesting subject to my mind. So, I thought it would be nice to share it and hope someone who knows well the storage subsystem internals would make the things clear for me and everyone who might ask the same question in the future.
Last edited by dbi; March 21st, 2010 at 21:58. |
|
#8
|
|||
|
|||
|
No nothing is lost of the ZFS capabilities as geli is transparent and running at a lower level than zfs - the only real effect is lower speed due to cryptography.
|
|
#9
|
|||
|
|||
|
What about encrypted swap and hibernate/resume?
|
|
#10
|
|||
|
|||
|
Encrypting swap is easy. See the examples in man geli.
Hibernate/resume highly depends on the hardware on which FreeBSD runs. IMHO FreeBSD is vary bad in this area compared to other OSes. |
|
#11
|
|||
|
|||
|
Quote:
There are, however, ways to work around that, like storing both your data and swap partitions on an encrypted LVM. |
|
#12
|
|||
|
|||
|
Probably, I'm doing something wrong: after completing all steps my laptop reboots after entering GELI password. And it's not panic,
Last edited by DutchDaemon; February 20th, 2012 at 23:44. Reason: We have space enough. |
![]() |
| Tags |
| disk, encryption, full, geli, zfs |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ZFS RAID: Disk fails while replacing another disk | hessi | General | 1 | March 3rd, 2010 17:19 |
| Disk Encryption Software - cross platform | FBSD | General | 1 | November 18th, 2009 22:01 |
| OpenVPN and Samba After Disk Full | abfan1127 | Web & Network Services | 2 | April 7th, 2009 16:29 |
| gmirror: lost disk, HOWTO proceed? | uisge | General | 2 | March 16th, 2009 21:26 |
| g_vfs_done() Error GEOM Disk Encryption | ter2007 | Installing & Upgrading | 4 | December 31st, 2008 17:26 |