Deploy A Cheap ZFS Storage VPS Using AlphaVPS
About
ZFS send and receive can be a fantastic tool for sending snapshots to remote servers, which can act as off-site backups. . However, acquiring cheap ZFS storage on the internet to facilitate this (because uploading from home is prohibitively slow) can be a bit of a struggle since ZFS is not not a standard/default filesystem that VPS servers come with. I don't want to shell out for a dedicated server if I can help it because that is significantly more expensive and has a much longer lead time. It can take a few days after an order to get your dedicated server compared to getting a VPS in minutes/seconds.
Luckily, in Alpha VPS (and likely other providers that provide the same control panel) one can install a server from scratch by telling the server to boot from one of the provided ISO images, and then manually installing the operating system from scratch. It's a bit of a faff, but everything is easy once you know how. This tutorial will show you how.
Steps
Order the VPS
Assuming you are logged in click the button to order a new service:
Click on the KVM Storage Virtual Servers link.
Click on the server you want, based on how much storage you need.
- Check you are happy with the price and paying monthly or annually.
- Ignore the password as we are going to install from scratch later.
- Ignore the operating system as well for now as we will select an ISO later. 4 Choose the location. This is important.
- Check the price breakdown.
- Click continue.
You will be shown a page t review everything before you checkout.
Enter your payment details...
You should now get a cofnirmation. I would screenshot this just in case, and then continue to the client area.
Boot Into Debian ISO
Your VPS should immediately appear in your products. Click on it.
Click the ISO button.
Select the Debian 11 ISO (I would have picked Debian 12 but it wasn't available).
Click on the Boot Order button.
Change it to CDROM.
Click Reboot and then noVNC Console.
Perform Manual Debian Installation
You may have to wait a bit, but eventually you should see menu for installing Debian 11. Continue with the Graphical install option.
Keep proceeding until you get to the partitioning steps. This part is very important. Choose manual.
Your menu should look like this by default. Click on the swap partition.
Delete the swap partition.
Click on the ext4 partition.
Delete the partition.
Click on the FREE SPACE.
Create a new partition.
Give it the minimum you think you need for the VM. I decided to give myself a lot of buffer space just in case I need it later and gave myself
30GB, which is actually a lot more than I should ever need (backups are not going onto this partition).
Make sure to select Beginning.
Click Done setting up the partition and continue.
Finish partitioning and write to disk.
You have to manually select No and continue to get past the fact that we deliberately
don't have any swap space. We can add it later using a file if we need to.
Choose Yes and continue to confirm our desired changes.
Proceed with the rest of the installation.
Boot Into Installed System
At the end of it, Debian will reboot into the ISO, showing the install screen. We need to undo our previous changes by using the web panel to configure the VPS to unmount the ISO, only boot from the hard disk, and then reboot.
I had to fight the system a bit because it seemed to be incredibly slow to respond to reboot/shutdown requests etc. In the end I had to run the shutdown and wait a while for the NoVNC console to disconnect before unmounting, and booting again.
From the web panel click on Boot Order.
Choose Hard Disk
Reboot
Perform Updates / Security Changes
Take this time to make your life easier by configuring SSH-key only access, before setting an easier password and/or passwordless sudo etc.
The last thing we want is to have our server brute force hacked because we use passwords, and we have to manually keep entering strong/difficult passwords.
Create Partition For ZFS
sudo fdisk /dev/vda
Create a new partition by pressing n
:
n
Then just follow the defaults to set the partition number and sectors.
Then just press w
to write changes to disk:
w
Now if we run lsblk
we should get the following output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 254:0 0 2T 0 disk
├─vda1 254:1 0 1M 0 part
├─vda2 254:2 0 27.9G 0 part /
└─vda3 254:3 0 2T 0 part
Install ZFS
Now install ZFS on Debian 11. If you installed a different distro, then follow the relevant instructions for it. Be sure to reboot afterwards, to be booted into a kernel that supports ZFS.
Create ZFS Pool
Now can create a ZFS pool using the /dev/vda3 partition we created earlier.
sudo zpool create zpool1 /dev/vda3
Now if we run ZFS list, we can see that we have a very large zpool at our disposal.
sudo zfs list
Conclusion
That's it! You now have a VPS with a ZFS pool that you can send/recieve snapshots to act as a remote backup server.
References
First published: 22nd October 2023