FreeBSD with ZFS installation on Vultr VPS


(This article is part of the Chinese version 在Vultr的VPS上安装支持ZFS的FreeBSD及SMTP问题的解决)

Vultr VPS is good cause thier VPS can be installed FreeBSD. The better thing is it can be installed OS from custom ISO.

I had tried the official FreeBSD 10/x64 image, but there is not ZFS. It had been fail when I tried to resize partition to create a ZPOOL. Fortunately,however, we can also install a FreeBSD from custom ISO.

Installation

At first, Let’s login the Vultr customer’s panel. At the bottom of tab page My Servers, you will find the My ISOs link, click into the page Upload Iso, fill in the Remote URL box with the ISO file URL, eg. FreeBSD-10.0-RELEASE-amdx64-bootonly is ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-RELEASE-amd64-bootonly.iso, and press the Upload button. The ISO file will be transfered from FreeBSD.org.

Transfer file between servers is fast. When it was done, you can switch to the page Deploy to create a new VPS. Select the appropriate Server Type, Location, Server Size_ according to your needs. Large memory is required for ZFS, 4G is recommended, bigger is better.

Select Custom in Operating System option and choose Virtual ISO is just uploaded ISO file ISO FreeBSD-10.0-RELEASE-amd64-bootonly.iso .

Then press Place Order button. You will get a new VPS and it will boot from this ISO now. Switch to the page My Servers and press the VPS’s Manage link. In the page Server Information you can press the View Console button to open the console window.

Now, you can install the FreeBSD in the console. There are some key steps:

  • make disk partition manually. eg. /boot=64K, /=4G, zfs=14G, swap=2G .
  • don’t set mount point for zfs and give it a label, eg. tank.
  • minimal installation, docs/sources/ports/etc. are excluded.
  • use DHCP to config the networking

After done, shutdown this VPS. Open the Custom ISO tab in the page Server Information , detach the ISO file and restart this VPS.

Now, you can log into the system via console or SSH and use it.

ZFS

You must create a zpool in zfs partition at first:

zpool create ztank /dev/gpt/tank

ztank is the zpool name, tank is the partition label name.

and create zfs like this:

zfs create -o mountpoint=/home/myusername/myhome ztank/myhome

or create a zfs for ports:

mv /usr/ports /usr/ports_old
zfs create -o mountpoint=/usr/ports -o compression=on ztank/ports
mv /usr/ports_old/* /usr/ports
rmdir /usr/ports_old

Enjoy it.