FreeBSD manual installation with ZFS

From Mann Systems
Jump to: navigation, search

These instructions assume a UEFI system with a single SATA disk

Installing minimal system

  • Boot freebsd-memstick and select 'shell' at the prompt
  • Partition disk:
# gpart create -s gpt ada0
# gpart add -t efi -b 1M -s 128M ada0
# gpart add -t freebsd-swap -s 4g ada0
# gpart add -t freebsd-zfs ada0
  • Prepare EFI system partition and install bootcode
# newfs_msdos /dev/ada0p1
# mount_msdosfs /dev/ada0p1 /mnt
# mkdir -p /mnt/EFI/BOOT
# cp /boot/boot1.efi /mnt/EFI/BOOT/BOOTX64.EFI
# umount /mnt
  • Create zpool and root datasets
# zpool create -R /mnt pool0 ada0p3
# zfs create -o mountpoint=legacy -o canmount=off pool0/ROOT
# zfs create -o mountpoint=/ -o canmount=noauto pool0/ROOT/FreeBSD
# zpool set bootfs=pool0/ROOT/FreeBSD
  • Mount root dataset and install FreeBSD base system and kernel
# zfs mount pool0/ROOT/FreeBSD
# cd /mnt
# tar zxvpf /usr/freebsd-dist/base.txz
# tar zxvpf /usr/freebsd-dist/kernel.txz
# echo 'zfs_load="YES"' > /mnt/boot/loader.conf
  • Reboot into new installation.
# zfs umount -a
# zpool export pool0
# reboot

Post-installation configuration

  • Set root password
# passwd root
  • Create /etc/rc.conf
hostname="beastie.home"
ifconfig_re0="DHCP"
keymap="uk"
sshd_enable="YES"
sendmail_enable="NO"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO"
sendmail_msp_queue_enable="NO"
zfs_enable="YES"  # Enable automatic mounting of all other ZFS datasets with canmount=on set
  • Set timezone:
# tzsetup
  • Create additional datasets:
# zfs create -o mountpoint=/usr -o canmount=off pool0/usr
# zfs create pool0/usr/local
# zfs create -o mountpoint=/home -o canmount=off pool0/home
  • Create /etc/fstab:
/dev/ada0p2   none   swap   sw              0 0
tmpfs         /tmp   tmpfs  rw,mode=01777   0 0