Here is how I install FreeBSD 9 with ZFS. This How-To is strongly inspired by gkontos "Root On ZFS @ FreeBSD 9". I will make it a little easier by using the installer to install the base system and setup time, network and everything else.
I strongly suggest you take a look at gkontos "Root On ZFS @ FreeBSD9". He go further into optimizing zfs partition. I will keep it simple here.
I strongly suggest you take a look at gkontos "Root On ZFS @ FreeBSD9". He go further into optimizing zfs partition. I will keep it simple here.
- Boot from a FreeBSD9 installation CD or DVD and choose install
- Select the keyboard you like
- Type the name you want for that machine
- Select what you want from the distribution. You can select doc, ports, source if you like
- On the partitioning screen, select Shell
- Now we will create the ZFS partition:
Code:gpart create -s gpt ada0 gpart add -b 34 -s 94 -t freebsd-boot ada0 gpart add -t freebsd-zfs -l disk0 ada0 gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
- We will create the zfs pool mount on /mnt:
Code:zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot /dev/gpt/disk0 zpool export zroot zpool import -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot zpool set bootfs=zroot zroot
- Copy the zpool.cache file on the disk to be able to get it back after installation:
Code:cp /var/tmp/zpool.cache /mnt/zpool.cache
- Add swap. In that case I add 4GB of swap:
Code:zfs create -V 4G zroot/swap zfs set org.freebsd:swap=on zroot/swap
- Type “exit†and go back to the let the installer finish the job
- Type a password for root
- Choose your network card and configure your network
- Set clock and time zone
- Select system configuration like sshd...
- Configure dumdev if you like
- Add other user if you like
- Select exit to finish installation
- On the manual configation screen choose YES, you need to copy back the zpool.cache file (very important step):
Code:cp /zpool.cache /boot/zfs/zpool.cache
- add the zfs driver:
Code:echo 'zfs_enable="YES"' >> /etc/rc.conf echo 'zfs_load="YES"' >> /boot/loader.conf echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf
- Type exit and choose reboot
- After reboot, it's now a good idea to take your first snapshot
Code:zfs snapshot zroot@config