FreeBSD 9.0 manual installation
This describes the process I follow to manually install FreeBSD 9.0 with a ZFS root. I mimic Solaris' ZFS dataset layout (pool0/ROOT/freebsd) and do not use the root dataset of the pool for data, like most of the FreeBSD ZFS root guides do.
Contents |
Boot into shell environment
At the FreeBSD Installer Welcome screen press 's' to run a shell.
Partition disks
Partition disks using GPT scheme, aligning partitions to 4KB sector offsets (not necessary for older disks, but worth doing for future proofing)
# gpart create -s gpt ada0 ada0 created # gpart add -t freebsd-boot -b 64k -s 64k ada0 ada0p1 added # gpart add -t freebsd-zfs ada0 ada0p2 added
Duplicate partition layout onto second disk:
# gpart backup ada0 | gpart restore ada1
Write bootcode to both disks:
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 bootcode written to ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 bootcode written to ada1
Create zpool
Create a small memory disk, mounted at /boot/zfs to hold the zpool.cache file that is written when the pool is created, as the root filesystem is mounted read-only.
# mdmfs -M -S -s 1m md2 /boot/zfs
Create pool, without a mountpoint
# zpool create -m none pool0 mirror ada0p2 ada1p2
Create ZFS datasets and mount root dataset
# zfs create pool0/ROOT # zfs create pool0/ROOT/freebsd # zfs set canmount=noauto mountpoint=/ pool0/ROOT/freebsd # mount -t zfs pool0/ROOT/freebsd /mnt
Extract FreeBSD distribution to new root
# cd /mnt # tar Jxpf /usr/freebsd-dist/base.txz # tar Jxpf /usr/freebsd-dist/kernel.txz
Make new system bootable
# cp /boot/zfs/zpool.cache /mnt/boot/zfs/ # zpool set bootfs=pool0/ROOT/freebsd pool0 # echo 'zfs_load="YES"' > /mnt/boot/loader.conf # echo 'vfs.root.mountfrom="zfs:pool0/ROOT/freebsd"' >> /mnt/boot/loader.conf
Configure system
At this point you can reboot into the newly installed system, but it is completely unconfigured. The following should be done:
- Set root password
- Create /etc/rc.conf, remembering to:
- Set hostname
- Configure network interface
- Set keyboard map
- Run sshd on boot
- Set the timezone (using tzsetup)
- Generate an aliases file (using newaliases)
- Create an empty fstab file (to silence error messages on boot