Run Proxmox Backup Server on TrueNAS

It’s recommended that you run Proxmox Backup Server (PBS) on a device separate from your Proxmox cluster and NOT as a VM inside of Proxmox, the idea being that it creates bad dependencies that make restore harder if your cluster fails (which is the point of your backups). If you run TrueNAS for your storage side-by-side with Proxmox, it might make sense to make run your PBS server as a VM on TrueNAS, which is a little difficult but can easily be accomplished with the steps below.

Setup Prerequisites

These instructions were written for the latest version of TrueNAS and PBS at the time of writing:

  • TrueNAS version 12.0-U4
  • Proxmox Backup Server version 1.1-1

They also assume you’ve already connected your TrueNAS storage to your Proxmox Cluster (e.g. as an NFS share).

Setup

Temporarily Install Proxmox Backup Server as a VM in Proxmox

  • Login to the Proxmox web GUI, create a VM and use the pbs ISO
  • Use UEFI bios
  • Make sure disk is “raw”. Use a small disk size (e.g. 16GB) for a faster dd later
  • Set the VM disk image to be on your TrueNAS storage, e.g. /mnt/tank/proxmox
  • Note the MAC address AND Proxmox VMID
  • Make sure you can connect to the web GUI, e.g. https://192.168.0.19:8007
  • Once you can connect, you don’t (yet) need to do any further setup
  • Shutdown the VM in Proxmox

Setup VM in TrueNAS

  • In the TrueNAS GUI, navigate to Storage -> Pools

  • Create a zvol. Put it under your existing VM dataset, or consider creating one if you don’t have one already. I use a dataset called truenas-VMs. Make the zvol the final size you need for your Proxmox Backup Server (I made mine 6TB). I used lz4 / sparse for the zvol.

  • From a shell (either use the TrueNAS web GUI shell or SSH into your TrueNAS machine), use dd to copy your raw Proxmox VM disk image to the new zvol. You’ll want to use this command: dd if=/<proxmox-dataset-share>/images/<VMID>/vm-<VMID>-disk-0.raw | pv -petr | dd of=/dev/zvol/<zvol-parent-dataset>/<zvol-name>

    • e.g. if the VMID is 100, the Proxmox nfs share is mounted at /mnt/tank/proxmox, your zvol parent dataset is /tank/truenas-VMs, and you named your zvol pbs, the command would be: dd if=/mnt/tank/proxmox/images/100/vm-100-disk-0.raw | pv -petr | dd of=/dev/zvol/tank/truenas-VMs/pbs
    • dd takes about 10m. You can check the TrueNAS storage UI to see the current size to get a sense of progress, or use zfs get all tank/truenas-VMs/pbs | grep used on the command line
  • In the TrueNAS GUI, navigate to Virtual Machines

    • Create a VM with:

      • Linux
      • Boot = UEFI
      • Use existing disk image (e.g. tank/truenas-VMs/pbs)
      • Re-use MAC address from earlier
    • Start the new VM

    • Fix the NIC (instructions from Proxmox forum)

      • Connect to VM via VNC (there is a “VNC” button under the VM dropdown)

      • Login via the shell

      • get the new interface name (in my case, enp0s4) using ip a

      • Update the configuration of the old interface to the new one. Replace the values below with your interface name, IP address, and gateway:

        /etc/network/interfaces
        auto lo
        iface lo inet loopback

        auto enp0s4
        iface enp0s4 inet static
        address 192.168.0.19/24
        gateway 192.168.0.1
        /etc/network/interfaces
        auto lo
        iface lo inet loopback

        auto enp0s4
        iface enp0s4 inet static
        address 192.168.0.19/24
        gateway 192.168.0.1
        • Save
        • ifup enp0s4
      • Verify using ip a that the correct interface now has the IP you specified:

        # ip a
        1: lo: ...
        2: enp0s4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether f6:00:3d:2f:87:ca brd ff:ff:ff:ff:ff:ff
        inet 192.168.0.19/24 scope global enp0s4
        valid_lft forever preferred_lft forever
        inet6 fe80::f400:3dff:fe2f:87ca/64 scope link
        valid_lft forever preferred_lft forever
        # ip a
        1: lo: ...
        2: enp0s4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether f6:00:3d:2f:87:ca brd ff:ff:ff:ff:ff:ff
        inet 192.168.0.19/24 scope global enp0s4
        valid_lft forever preferred_lft forever
        inet6 fe80::f400:3dff:fe2f:87ca/64 scope link
        valid_lft forever preferred_lft forever
      • Make sure you can connect to the web GUI, e.g. https://192.168.0.19:8007

  • Expand disk

    • Even though you originally created at 16GB and copied it to a 6TB zvol, we need to make Proxmox Backup Server aware of the extra space.
    • Login to the PBS web GUI (e.g. https://192.168.0.19:8007) and open the shell
    • Run pvdisplay. There should be one physical volume. Make note of the “PV Name”, /dev/sda3 in my case
    • Run lvdisplay. The second volume (the first non-swap volume) should have an LV Name of root. Make note of the “LV Path”, /dev/pbs/root in my case
    • Run pvdisplay <PV Name> | grep "PV Size" (e.g. pvdisplay /dev/sda3 | grep "PV Size")
      • The printed “PV Size” should be <15.50 GiB
    • Run (adjust the commands if your PV Name was something other than /dev/sda3 or your PV Path was something other than /dev/pbs/root):
      fdisk /dev/sda # the first part of your PV Name, minus the number suffix
      p
      d (pick last partition, 3, the number suffix from your PV Name)
      n e (pick defaults for full size)
      t (pick last partition, 3, the number suffix from your PV Name. Then enter 31, or whatever "Linux LVM" is listed as in "L")
      w
      pvresize /dev/sda3
      lvdisplay
      lvresize -l +100%FREE /dev/pbs/root
      resize2fs /dev/pbs/root
      pvidsplay
      fdisk /dev/sda # the first part of your PV Name, minus the number suffix
      p
      d (pick last partition, 3, the number suffix from your PV Name)
      n e (pick defaults for full size)
      t (pick last partition, 3, the number suffix from your PV Name. Then enter 31, or whatever "Linux LVM" is listed as in "L")
      w
      pvresize /dev/sda3
      lvdisplay
      lvresize -l +100%FREE /dev/pbs/root
      resize2fs /dev/pbs/root
      pvidsplay
    • Re-run pvdisplay <PV Name> | grep "PV Size" (e.g. pvdisplay /dev/sda3 | grep "PV Size")
      • The printed “PV Size” should now be <6.00 TiB
    • Verify that datastore is 6TB in PBS GUI

Setup PBS

  • Create a new datastore in PBS (point at /mnt/backup, give it a name)

Connect PBS to your Proxmox Cluster

  • Add as new storage to Proxmox Cluster
    • id is arbitrary.
    • fingerprint comes from PBS dashboard -> “show fingerprint”
    • Username is always “root@pam”
  • Point Proxmox Cluster backup to new storage
  • You’re now done with the migration. Do any other setup you’d like!

Optional Cleanup

  • Optional: Purge temporary VM in Proxmox
  • Optional: Remove old storage from Proxmox Cluster when we’re sure we’re done (the if path from the dd command above)