FreeBSD 10.2-RELEASE on a Dedibox XC server (Online.net) with root on ZFS
  2015-10-30

FreeBSD logo

Goals

Getting up and running FreeBSD 10.2-RELEASE with root on ZFS on a Dedibox XC server, which is a dedicated server provided by Online.net company.

GUID Partition Table (GPT) and 4k sector drives alignment are automatically handled by the FreeBSD installer.

Why?

Because the provided FreeBSD setup assistant does not permit ZFS filesystem at all, therefore ZFS on / is not exactly a breeze:

Requirements

  • Your server public IPv4, gateway and netmask.
  • IP of a working DNS server.
  • Know your way through FreeBSD setup.
  • Having acknowledged that YMMV with a different server model and/or FreeBSD version. (comments are welcome)
  • Having acknowledged that in case of data loss or whatever problem you can encounter, you are on your own.

Steps

Since the virtual media feature of the KVM over IP is not really useful (ISO file has to be hosted on an Samba share), the idea is to:

  • Boot the server on an Ubuntu live CD.
  • Install Qemu.
  • Fetch a FreeBSD Installer ISO image.
  • Start the FreeBSD installer through Qemu attached to the physical server disk.

Thanks Jeremie for the Qemu idea!

Online.net account

On your Online.net account, go to:

  • “Server” dropdown menu, then “Servers list”.
  • Click on “Manage” on the right.
  • “Rescue” button.
  • As operating system select “Ubuntu 13.10 amd64”.
  • Then start the operation, you server will boot on the Ubuntu live CD.

Dedibox server

  • Log in the rescue live system through ssh with the provided ip/credentials.
  • The provided Ubuntu version is outdated (Ubuntu Saucy), so the apt repositories have to be modified before Qemu could be installed:
$ sudo -s
# sed -ri "s/(mirrors.online.net|security.ubuntu.com)/old-releases.ubuntu.com/g" /etc/apt/sources.list
# apt-get update
# apt-get install qemu-kvm

Fetch a FreeBSD Installer ISO image:

# wget ftp://ftp.fr.freebsd.org/mirrors/ftp.freebsd.org/releases/ISO-IMAGES/10.2/FreeBSD-10.2-RELEASE-amd64-disc1.iso

Note: Full install from the -disc-1.iso (no network needed) is easier than fiddling with a bridge/Qemu networking on the live system.

For the post-install network configuration step (/etc/rc.conf), try to figure out now what is your NIC model (Handbook: Locating the correct driver)

# lspci -v |grep Ethernet
00:14.0 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 03)
00:14.1 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 03)

In my server, the igb driver handles this nic.

If you are not sure, boot on the FreeBSD rescue live-cd, and note the interface name.

Start the FreeBSD installer through Qemu, attached to the pysical server disk, with the curses UI:

# qemu-system-x86_64 -hda /dev/sda -cdrom FreeBSD-10.2-RELEASE-amd64-disc1.iso -net none -curses -boot d

  • On the partitioning dialog, choose Auto (ZFS) Guided Root-on-ZFS
  • Follow installer up to the end, and when asked for Manual Configuration, choose yes to open a shell before exiting the installer.
  • Configure the network, modify the files accordingly to your network setup/nic driver:
# /etc/rc.conf

ifconfig_igb0="inet x.x.x.x netmask 255.255.255.0"
defaultrouter='x.x.x.x'

# /etc/resolv.conf
nameserver x.x.x.x
  • Depending your ram size, and because the emulated system through Qemu does not reflect the real server memory:
# echo 'vfs.zfs.prefetch_disable="0"' >> /boot/loader.conf
  • Ensure to have either a local user account in the wheel group (to be able to su - to root), or PermitRootLogin yes in /etc/ssh/sshd_config.

  • Profit! Exit the installer, shut down the emulated system, and reboot the server from the Ubuntu live CD.