[TUTORIAL] PBS on TrueNAS - Have your cake and eat it too

PwrBank

Member
Nov 12, 2024
61
14
8
What?
Are you wanting to use PBS to backup your servers, but want to use TrueNAS as the storage handler?
I've been using this setup for the last few weeks and it has worked perfectly.

With the latest update of TrueNAS Community Edition, 25.04, you can run Linux Containers (LXC) natively on the system.

Why?
This will allow you to have the ZFS back end of TrueNAS handle snapshots, replication, etc. for a robust storage layer. TrueNAS is a little more user friendly when it comes to managing the actual devices involved in the storage. You can easily expand the storage, divide it up for other uses, and run other services if you wanted to.

How?

⚠️ You will need TrueNAS 25.04 (or newer) in order to get LXC support.

Setting up the Debian container
We will be using a Debian LXC as the base for PBS.

Navigate to the Instance section within TrueNAS
1740574050612.png
And create a new instance with a Debian Bookworm image
1740574097439.png
(By default it will allow all RAM and CPU to be shared with the container, set this according to your needs)

Add a disk, create a new dataset for us with the PBS container
For the destination, I chose /mnt/pbs
1740574230217.png
If you'd like to use the same IP address as the TrueNAS system, add a proxy setting. I assigned the default ports used by PBS with HTTPS.
1740574300406.png

Press Create


(THIS PART COULD USE FEEDBACK FROM THE COMMUNITY, I'M NOT GOOD AT LINUX PERMISSIONS YET, THIS JUST WORKED FOR ME AND MAY NOT BE THE MOST SECURE SETTINGS)
Navigate to the dataset that was created and change the permissions to the preset ACL named "POSIX_OPEN" and set the owner and group to "backup"
1740574362213.png

Navigate back to the Instance page and connect to the container with the Shell button
1740574422878.png

️️ Installing PBS
Once you are in the shell of the container, set the root user password with
passwd

Create the directory that will be used for the PBS datastore (This will be the directory mounted in the LXC creation plus a folder inside of that)
mkdir /mnt/pbs/data

Run the following commands
Bash:
# Update available repositories
apt update

# Install wget and nano
apt install wget nano

#Add the Proxmox repository key to the install
wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

Edit the apt repository list and add the Proxmox repositories
nano /etc/apt/sources.list

Add the following to the sources list
Code:
# PBS no-subscription
deb http://download.proxmox.com/debian/pbs bookworm pbs-no-subscription

# security updates
deb http://security.debian.org/debian-security bookworm-security main contrib

Update the apt repositories and install PBS
Bash:
apt update
apt install proxmox-backup-server

Once the installation process if finished, should be able to connect to the TrueNAS IP but on port 8007 via HTTPS
Login using the root account and using the Linux PAM realm
1740574898168.png

Create a new datastore using the path that was created at the beginning of the PBS install
1740574928091.png
Press Add

The new dataset should be created and show the full size of the dataset that was created for the data in TrueNAS
1740574954193.png


This has been used heavily in my test environment and working perfectly as expected.
1740575006350.png

TrueNAS also has a scheduled snapshot created of the dataset every 6 hours and keep it for 3 days, hopefully to prevent accidental deletion or in an event where the PBS is subject to ransomware.



❓ If you have any feedback, please leave it below and I will try to accommodate this guide as best as I can
 
Last edited:
  • Like
Reactions: Johannes S and UdoB