As FreeBSD progresses I thought I would post updated to FreeBSD 10 / 9.2 procedure that I currently use.
The only 'problem' with ZFS is now its fragmentation which was supposed to be fixed by
'Block Pointer Rewrite' but as we know that did not happened. One of the sources of this fragmentation is that before the data gets written to the pool, ZFS first writes metadata there, then copies the data and then finally removes the metadata. That removal of metadata is the main cause of ZFS fragmentation. To eliminate this problem I suggest using a separate ZIL device for each pool. In the perfect case ZIL should be mirrored, but if You do setup for a single disk, then creating redundant ZIL for non redundant pool is useless ...
ZIL can be grow up to half of RAM, while my current box has 16 GB of RAM I do not think that I will be able to see ZIL filled up to 8 GB, so I have chosen to create 4 GB of ZIL for the 'data' pool and 1 GB for the rather small 16 GB 'root' pool.
As GRUB2 becomes more popular in BSD world (thanks to PC-BSD) You may want to consider using it in the future, that is why I suggest leaving 1 MB space at the beginning for GRUB2 if necessary, in other words the root pool starts after 1 MB.
Code:
ada0p1 512k bootcode
-free- 512k -free- (total 1 MB in case of GRUB2)
(boot) ada0p2 16g sys.LZ4
ada0p3 1g sys.ZIL
ada0p4 4g local.ZIL
ada0p5 * local.GELI.LZ4
Here are the commands that I used.
Code:
gpart destroy -F ada0
gpart create -s gpt ada0
gpart add -t freebsd-boot -s 1m -l boot ada0
gpart add -t freebsd-zfs -s 16g -l sys ada0
gpart add -t freebsd-zfs -s 1g -l sys.zil ada0
gpart add -t freebsd-zfs -s 4g -l local.zil ada0
gpart add -t freebsd-zfs -l local ada0
gpart delete -i 1 ada0
gpart add -t freebsd-boot -s 128k -l boot ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
geli init -b -s 4096 /dev/gpt/local
geli attach /dev/gpt/local
zpool create -f local /dev/gpt/local.eli log /dev/gpt/local.zil
zpool create -f sys /dev/gpt/sys log /dev/gpt/sys.zil
zfs set compression=lz4 sys
zfs set compression=lz4 local
zfs set atime=off sys
zfs set atime=off local
zfs set mountpoint=none sys
zfs set mountpoint=none local
zfs create sys/ROOT
zfs create sys/ROOT/default
zpool set bootfs=sys/ROOT/default sys
zfs create local/home
zfs set mountpoint=/mnt sys/ROOT/default
zfs mount sys/ROOT/default
zfs set mountpoint=/mnt/home local/home
zfs mount local/home
cd /usr/freebsd-dist/
tar --unlink -xvpJf base.txz -C /mnt
tar --unlink -xvpJf src.txz -C /mnt
tar --unlink -xvpJf lib32.txz -C /mnt
tar --unlink -xvpJf kernel.txz -C /mnt --exclude '*.symbols'
echo zfs_enable=YES > /mnt/etc/rc.conf
:> /mnt/etc/fstab
cat > /mnt/boot/loader.conf << EOF
zfs_load=YES
aio_load=YES
geom_eli_load=YES
EOF
zfs umount -a
zfs set mountpoint=legacy sys/ROOT/default
zfs set mountpoint=/home local/home
reboot
Code:
pkg (answer 'y' to bootstrap)
pkg add beadm
chmod 1777 /tmp /var/tmp
cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
newaliases
passwd
(...)