Installing FreeBSD with ZFS

Introduction
By default, our FreeBSD images are installed with UFS. For most people, however, ZFS is the preferred filesystem, this article will guide you through the steps that will have to be taken in order to use ZFS.

Setup your FreeBSD system and launch Rescue mode
First setup a VPS using our default FreeBSD image. When the installation completes, you'll have to boot the VPS into rescue mode. In order to boot into rescue mode, just go to the 'Server overview' and select your server. Then under 'Tasks' you will find the option 'Start in rescue mode'.

ZFS Installation
Once you've started rescue mode you'll be presented with the FreeBSD installer as shown below. Choose 'Install'. 
Screen_Shot_2016-05-13_at_11.08.19_AM.png

From there on, you'll be asked to provide the following information:

  1. Keymap Selection: "Continue with default keymap"
  2. Set hostname: "Choose the hostname you would like to set"
  3. Distribution select: "Options here can be disabled/enabled as you like"


Partitioning
When you've finished the steps above you'll be presented with the following screen. For this article, we'll pick 'Auto (ZFS) Guided Root-on-ZFS'.
Screen_Shot_2016-05-13_at_11.16.06_AM.png

ZFS Configuration
The following step is to set up our ZFS options. There're quite a few options to choose from: Change the swap size from 2G to 0. The swap partition will be on a separate VirtIO block device otherwise you'll be wasting space :)
Screen_Shot_2016-05-13_at_11.18.52_AM.png

First, we'll have to select the appropriate disk to proceed with the installation. Select 'Pool Type/Disks' and press 'Enter' (Alternatively press 'T' and 'Enter').

Select virtual device type. Select 'stripe' as shown below and press 'Enter'.
Screen_Shot_2016-05-13_at_11.27.05_AM.png

Additional information
You'll see 2 VirtIO block devices. Select 'vtbd0'  and press 'Enter'. This is the device we wish to install ZFS on. The other one 'vtbd1' is the swap partition which is 1GB and should be left alone. Don't forget to turn on the swap partition after installation: 'swapon /dev/vtbd1' also make sure it's added at boot by placing the following entry in /etc/fstab:

# Swap space on a block device.
/dev/vtbd1	     none	     swap    sw		     0	     0


Screen_Shot_2016-05-13_at_11.29.50_AM.png

Once you've pressed enter you'll be returned to the main menu from where you should now be able to proceed with the installation. You'll be asked to confirm the installation as shown below:
Screen_Shot_2016-05-13_at_11.32.33_AM.png

Your installation will now start and FreeBSD will be re-installed with ZFS. You'll be prompted for the following additional information:

  • Specify your root password.
  • Network configuration (You can use DHCP to setup your network configuration for both IPv4 and IPv6).
  • Resolver configuration (You can leave this at the default that's presented).
  • Select local or UTC time (Pick option 'NO').
  • System configuration (optional).
  • Add additional system users (optional).

Once you've walked through these steps you'll be shown with the final configuration menu, you can now exit the installation and reboot your VPS. Your system is now installed with ZFS!
Screen_Shot_2016-05-13_at_11.43.13_AM.png

Additional guides / references
https://www.freebsd.org/doc/handbook/
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/zfs.html

Have more questions? Submit a request

0 Comments

Article is closed for comments.