Truenas core allow.mount.zfs in VM? (UrBackup)

Is there a way to pass thru the ZFS file system to a VM?
I know this can be done for jails but what about VMs?

I’m running truenas core 13.0-U6.1. In there i have a VM with debian 11 in where i install apps that don’t have FreeBSD ports (looking at you openproject!).

At the moment i’m trying to install the docker container for UrBackup which can take advantage of the ZFS filesystem but it needs access to it.

According to this Tutorial: Install Urbackup on FreeNAS and ZFS, if i wanted to install UrBackup in a jail i would have to set the following properties


How can i pass these same properties/permissions to a VM?

And before you suggest to just install Urbackup in a jail, i just prefer not to do it. The official port has no maintainer and, according to UrBackup, “The FreeBSD port is currently broken”. This means that it would have to be installed from source which i don’t know how to update.

AFAIK, the only way is to mount an NFS share.

(Or an SMB share, but NFS is more unixy)

P9FS is sometimes mentioned, but this is not supported.

This is where my ignorance will shine.

My understanding is that URBackup creates datasets for each client PC where it saves their backup files.

If i create an NFS share accessible from the VM, will URbackup be able to create the ZFS datasets on that NFS share?

No. It can make files and directories via NFS, but no manage ZFS directly.

Do you know if its possible to mount a dataset directly to a folder in the VM?

No, not as a VM. When using a VM you are communicating over a networking protocol, so you must use something like SMB/NFS/ISCSI/S3.

If you want to do bind or nullfs type mounts, you would run applications as a container, which gives you direct dataset access, no network hop required.

1 Like

is there anything similar for when you want to run a container in Truenas Core?

Jails, but they are unsupported and unmaintained, primarily used by advanced users comfortable with FreeBSD already. <cautionary noises here>

Good, i thought i was missing something.
I am familiar with jails but i want to avoid it in this case the FreeBSD port for URbackup is broken and has no maintainer.

I could install it from source in a jail but i have no experience updating apps from source.

Updating from source is simply recompiling the necessary files and replacing the old ones with the new ones.

Or (as in the case of Nextcloud) updating using built in update tools.

This is slowly morphing into another topic but, would you mind walking me through the process?

Lets assume i have a previous version of URBackup which i installed from source (lets call it V2.49).

I want to upgrade it to the newest version which is 2.53.33

so, i would SSH into the jail then

tar xf urbackup-server-2.5.33.tar.gz
cd urbackup-server-2.5.33
sudo make install

And after this URbackup would be running V2.5.33?
Do i need to uninstall anything prior to these steps?

If that is the case, then my solution would be very simple. Just install it in a Jail.

Since it looks like the make install command just generates a binary, you would just copy the newly compiled binary to the /usr/local/bin directory, and chmod +x the binary.

The make install command should dump the compiled binary into your PWD (current directory) so a chmod +x urbackupsrv && cp urbackupsrv /usr/local/bin/urbackupsrv should do the trick.

You should also get the rc startup script form the pkg install so you don’t have to build your own.

Understood. Thanks for the help.
I would call this thread solved. It seems TrueNAS core cannot pass thru the ZFS system to its VMs.

As for me, i will try to install URBackup on its own jail. If i succeed, i will post my instructions so others can benefit.

You can mark whichever post is the solution as “Solved”

I believe in order to do that you need to share the zfs device info a container.

Which means using a Sandbox as @kris pointed out

This SO talks about accessing zfs for inside a docker

For me it worked with:

  • docker container in privileged mode
  • zfs device mapped into the container (–device /dev/zfs)
  • zfsutils-linux installed in the container

I think bind mounting /dev/zfs into a sandbox would work. And you could probably use jailmaker docker template, and then a docker image for urbackup too.

I’d suggest using container images (ie docker) whenever possible inside a sandbox for ease of support/maintenance etc

@Stux, your advisement circles back to my original question. How do you expose the truenas core ZFS to a VM running debian so i can “bind mounting /dev/zfs” into a container?

Based on this thread it appears that trueNAS cannot expose its ZFS to a VM. That is why I’m now trying to install URbackup inside a jail.

Now, I’m fighting to learn how to expose the truenas ZFS into a jail.

well, i just discovered that if i do the following on the truenas host i can expose the ZFS dataset to the urbackup jail

zfs jail 37 Vault/Apps/urbackup

Where 37 is the iocage JID for the jail called “urbackup” and “Vault/Apps/urbackup” is the dataset i created to save all the backup files from urbackup.

My new problem is that this is not persistent. It will work until the truenas server is restarted.

How can i associate this command with this jail?
Is there something like a pre-start script for jails in truenas?

You can mount those datasets into the jail under Jails > Mount Points

I’m not sure that is correct.
My understanding is that the mountpoints would make the dataset’s filesystem available to the jail, not the dataset itself.

In my case, i have already mounted 3 datasets in the jail. But when i do “zfs list” from within the jail i get

root@urbackup:~ # zfs list
no datasets available

but, if i do the following from the truenas host after the jail is running

zfs jail 37 Vault/Apps/urbackup

i get

root@urbackup:~ # zfs list
NAME                         USED  AVAIL     REFER  MOUNTPOINT
Vault                        743G  4.60T      336K  /mnt/Vault
Vault/Apps                  9.09G  4.60T      272K  /mnt/Vault/Apps
Vault/Apps/urbackup          888K  4.60T      288K  /mnt/Vault/Apps/urbackup
Vault/Apps/urbackup/backup   200K  4.60T      200K  /mnt/Vault/Apps/urbackup/backup
Vault/Apps/urbackup/files    200K  4.60T      200K  /mnt/Vault/Apps/urbackup/files
Vault/Apps/urbackup/images   200K  4.60T      200K  /mnt/Vault/Apps/urbackup/images

I’m playing with the jail properties to see where i get.

Ideally i should be able to run that command automatically after the jail has started.

Another issue i found is that, for some reason, in my system that command only works with the JID which changes everytime i start the jail. if i try that command with the Jailname it fails.