I think you know what you doing. If you mess your system up, it’s your own problem. You’ve been warned.
Requirements
Minimum processor: 1.2Ghz (Pentium4/Athlon-XP works fine)
Minimum memory: 768Mb of RAM (1Gb or more is recommended).
Instalation
Let’s suppose that you have a 40Gb HD to use:
- Boot FreeBSD 7.0 CD
- Partition the whole disk
- Make 3 slices
/ -> 1Gb
swap -> you decide with your own practices (or FreeBSD best practices)
The rest of the disk.
- Now install the Minimal, then reboot.
Creating the pool
After the installation is complete, jump to single user mode and mount your / rw:
# mount -w /
Now we create the disk pool, let’s suppose that the 3rd partition that you create is ad0s1d:
# zpool create rootvg /dev/ad0s1d
But after start creating the filesystems, stop the automount:
# zfs set mountpoint=none rootvg
Now we’ll create the mount points:
# zfs create rootvg/root
# zfs create rootvg/usr
# zfs create rootvg/var
# zfs create rootvg/tmp
Now, we can set the first set of mountpoints (to install data):
# zfs set mountpoint=/rootvg rootvg/root
# zfs set mountpoint=/rootvg/usr rootvg/usr
# zfs set mountpoint=/rootvg/var rootvg/var
# zfs set mountpoint=/rootvg/tmp rootvg/tmp
Use a df and you’ll understand.
Now, copy the whole filesystem from / to /rootvg (there’s a lot of methods to do that)
*DON’T BOOT YOUR OS, YET*
Booting FreeBSD
I don’t remeber where I get this trick: You know, FreeBSD bootloader doesn’t know what ZFS is (yet), so, we need to do some tricks:
Remove the boot from the /rootvg:
# rm -fr /rootvg/boot
Create a new dir inside the /rootvg and link the outside-boot with the inside-boot:
# mkdir /rootvg/bootdist
# cd /rootvg
# ln -s bootdist/boot boot
Now, tell the loader to get the ZFS support and mount the ZFS root partition
Don’t forget to set vm stuff (since ZFS in FreeBSD is experimental, it’s easily to run out of memory and crash the kernel).
# echo ‘zfs_load=”YES”‘ >> /boot/loader.conf
# echo ‘vfs.root.mountfrom=”zfs:rootvg/root”‘ >> /boot/loader.conf
# echo ‘vm.kmem_size_max=”512M”‘ >> /boot/loader.conf
# echo ‘vm.kmem_size=”512M”‘ >> /boot/loader.conf
# echo ‘vfs.zfs.zil_disable=1′ >> /boot/loader.conf
Don’t forget to put the boot into the first line of fstab:
/dev/ad0s1a /bootdist ufs rw 1 1
Now, let’s do the magic:
# cd /
# zfs set mountpoint=/tmp rootvg/tmp
# zfs set mountpoint=/usr rootvg/usr
# zfs set mountpoint=/var rootvg/var
Set root to legacy because the loader will to the job:
# zfs set mountpoint=legacy rootvg/root
All done. Now you can reboot your FreeBSD and start to install things.