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'.
Once you've started rescue mode you'll be presented with the FreeBSD installer as shown below. Choose 'Install'.
From there on, you'll be asked to provide the following information:
- Keymap Selection: "Continue with default keymap"
- Set hostname: "Choose the hostname you would like to set"
- Distribution select: "Options here can be disabled/enabled as you like"
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'.
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 :)
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'.
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
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:
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!
Additional guides / references