Installing FreeBSD 9.0-RELEASE Root on ZFS using GPT
This memo is my log during installing 9.0-RELEASE with new bsdinstaller.
WARNING! please update if errors found, or merge this text to other pages.
- Boot FreeBSD install DVD or USB Memstick
- Choose Shell option at Partitioning dialog in bsdinstall
- Create partitions
# gpart create -s gpt ada0 # gpart create -s gpt ada1 # gpart add -s 64K -t freebsd-boot -l boot0 ada0 # gpart add -s 8G -t freebsd-swap -l swap0 ada0 # gpart add -t freebsd-zfs -l disk0 ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 # gpart add -s 64K -t freebsd-boot -l boot1 ada1 # gpart add -s 8G -t freebsd-swap -l swap1 ada1 # gpart add -t freebsd-zfs -l disk1 ada1 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 # zpool create -o altroot=/mnt zroot mirror /dev/gpt/disk0 /dev/gpt/disk1 # zfs create zroot/tmp # chmod 1777 /mnt/tmp # zfs create zroot/usr # zfs create zroot/var # zfs create zroot/home # exit
- After exiting from shell, proceed installation
When asked to create partitions, select "Shell", then type exit.
- When installation is finished, choose Live CD option and login as root
- Fix mountpoint and zpool cachefile
# echo 'zfs_enable="YES"' >> /mnt/etc/rc.conf # echo 'zfs_load="YES"' >> /mnt/boot/loader.conf # echo 'vfs.root.mountfrom="zfs:zroot"' >> /mnt/boot/loader.conf # zfs unmount -a # zpool export zroot # zpool import -o cachefile=/tmp/zpool.cache -o altroot=/mnt zroot # zfs set mountpoint=/ zroot # cp /tmp/zpool.cache /mnt/boot/zfs/ # zfs unmount -a # zpool set bootfs=zroot zroot # zpool set cachefile='' zroot # zfs set mountpoint=legacy zroot # zfs set mountpoint=/tmp zroot/tmp # zfs set mountpoint=/usr zroot/usr # zfs set mountpoint=/var zroot/var # zfs set mountpoint=/home zroot/home
- after these commands, type reboot from Live CD to finish installation