Support #765
Updated by Daniel Curtis almost 9 years ago
This is a guide on how I manually setup FreeBSD with a ZFS root, without the help of a GUI or bsdinstall. This guide is intended to install FreeBSD using the installation DVD and will work offline. * When the FreeBSD Installer Welcome message appears, choose *Shell*. * Create the slices: <pre> gpart create -s gpt ada0 gpart add -b 40 34 -s 512K -l gpboot 64k -t freebsd-boot ada0 gpart add -s 4G -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 </pre> * # Create ZFS pool and root dataset, then mount it: pools <pre> zpool create -o cachefile=/boot/zfs/zpool.cache -m none -f rpool /dev/gpt/disk0 zfs set checksum=fletcher4 rpool zfs create rpool/root mkdir /tmp/mntzfs zfs set mountpoint=/tmp/mntzfs rpool/root </pre> #* Then create some additional system datasets: <pre> zfs create -o canmount=off rpool/root/usr zfs create -o canmount=off rpool/root/var zfs create -o compression=on -o exec=on -o setuid=off rpool/root/tmp zfs create -o compression=gzip -o setuid=off rpool/root/usr/ports zfs create -o compression=off -o exec=off -o setuid=off rpool/root/usr/ports/distfiles zfs create -o compression=off -o exec=off -o setuid=off rpool/root/usr/ports/packages zfs create -o compression=gzip -o exec=off -o setuid=off rpool/root/usr/src zfs create -o compression=lzjb rpool/root/usr/obj zfs create -o compression=lzjb -o exec=off -o setuid=off rpool/root/var/crash zfs create -o compression=off -o exec=off -o setuid=off rpool/root/var/empty zfs create -o compression=lzjb -o exec=on -o setuid=off rpool/root/var/tmp </pre> * Export and then reimport the zfs pool: <pre> zpool export rpool zpool import -o cachefile=/tmp/zpool.cache rpool </pre> * Set the permissions of the temp directories in the zfs mount: <pre> chmod 1777 /tmp/mntzfs/tmp chmod 1777 /tmp/mntzfs/var/tmp </pre> * Extract the base.txz and kernel.txz to the zfs root to install the base system: <pre> cat /usr/freebsd-dist/base.txz | tar --unlink -xpJf - -C /tmp/mntzfs cat /usr/freebsd-dist/kernel.txz | tar --unlink -xpJf - -C /tmp/mntzfs cp /tmp/zpool.cache /tmp/mntzfs/boot/zfs/zpool.cache </pre> * Add the initial system configuration: <pre> echo 'zfs_enable="YES"' >> /tmp/mntzfs/etc/rc.conf echo 'zfs_load="YES"' >> /tmp/mntzfs/boot/loader.conf echo 'if_em_load="YES"' >> /tmp/mntzfs/boot/loader.conf echo 'vfs.root.mountfrom="zfs:rpool/root"' >> /tmp/mntzfs/boot/loader.conf echo 'sshd_enable="YES"' >> /tmp/mntzfs/etc/rc.conf echo 'ifconfig_em0="inet 192.168.10.70 netmask 255.255.255.0 broadcast 198.100.10.255"' >> /tmp/mntzfs/etc/rc.conf echo 'defaultrouter="192.168.10.1"' >> /tmp/mntzfs/etc/rc.conf echo 'hostname="freebsd.example.com"' >> /tmp/mntzfs/etc/rc.conf echo 'nameserver 192.168.10.1' >> /tmp/mntzfs/etc/resolv.conf </pre> * Unmount the zpool: <pre> zpool export rpool </pre> * Reboot the system and eject the FreeBSD install disc: <pre> reboot </pre> h2. Resources * https://forums.freebsd.org/threads/42773/