Using PBS with a Unifi NAS ??

ThierryIT69

Member
Mar 28, 2024
31
4
8
Hello,
I am not very lucky with this NAS.
I am not able to add a new datastore on a fresh install PBS.
I do have this problem on a standalone pc or on a VM.
What I did on both pc/vm:
Code:
- Update PBS after installing it.

- add the IP of my PBS to the Unifi nfs Drive

- create a shared folder (mkdir -p /mnt/nfs) on the PBS

- chown backup:backup /mnt/nfs and chmod 775 /mnt/nfs on the PBS

- mount the shared folder using: mount -t nfs ip_number:/var/nfs/shared/[Shared Drive Name] /mnt/nfs on the PBS

- checking if I can write to the shared folder with the user "backup" on the PBS

All working, I am able to add/write a file with the user "backup" on the /mnt/nfs shared.
But I cannot add a new datastore: error message: datastore not empty or permission or owner not correct.

Any ideas ?
 
In general network storage isn't a good fit for PBS see https://forum.proxmox.com/threads/datastore-performance-tester-for-pbs.148694/ and https://pbs.proxmox.com/docs/system-requirements.html#recommended-server-system-requirements

Is your NAS able to host vms? Then it might be worth to have the PBS as VM directly on the NAS. It would also allow you to recover your backups even if your ProxmoxVE server gets wrecked somehow.

Did you already check whether you can add a NFS share as normal NFS storage on your PVE (for vma backups)?
 
  • Like
Reactions: Ernst T. and UdoB
Dear sir,
I am a private person, not a company, the backcup storage is a good compromise for me, with of course, a good networks.
I am planning (later this year) to upgrade to a 10G SFP+ networks to manage my backups.
My NAS (Unifi Pro7) cannot host VM or Dockers.
Today, without PBS, I am manually and regularly "backuping" my VM to my NAS directly every time I made changed or when I do have a new VM.
Few month ago I was using the PBS as VM in my cluster and I was able to add a datastore using the same NAS. After seeing some videos on Youtube I have decided to separate my PBS from the cluster and use a tiny pc. All are done, as I said I am able to mount the NFS share on my "new" PC and I am able to read/write on it.

I still have permissions pb.
On the PBS, the permissions for my shared folder are:

Code:
root@pbs:/mnt# ls -l
total 0
drwxrwx--- 1 988 988 24 Mar 20 16:39 nfs

Something strange, my backcup user ID/GiD is 34, but as you can see, I have 988 instead.

Error message:
unable to open existing chunk store path "/mnt/nfs" - permissions or owner not correct
or
EPERM


Thx a lot for your support.
 
Last edited:
unable to open existing chunk store path "/mnt/nfs" - permissions or owner not correct
I do not know what "988:988" stands for in your setup - but it is not the usual "backup" id.

For me it helped to set the "backup" user as the owner: chown -R backup:backup /mnt/nfs . For an NFS mounted folder with the name "dsa" on a PBS I can see:
Code:
pbsb:/srv# ls -Al . ;  ls -Al dsa
total 0
drwxrwx--- 1 backup backup 172 Mar  1 07:17 dsa
drwxrwx--- 1 backup backup  44 Mar  7 22:10 hosts
total 4
drwxr-x--- 1 backup backup 524288 Sep  5  2020 .chunks

Code:
~# id backup
uid=34(backup) gid=34(backup) groups=34(backup),26(tape)


Sidenote: I always say that NFS is not a good idea and not recommended for PBS. I have no problem to ignore my own advice from time to time, especially in my homelab... ;-)
 
I might have found where the pb can be:

When the shared is umounted:
Code:
root@pbs:/mnt# ls -l
total 0
drwxr-xr-x 3 root   root   23 Mar 21 09:11 datastore
drwxrwx--- 2 backup backup  6 Mar 20 12:33 nfs

When the share is mounted:
Code:
root@pbs:/mnt# ls -l
total 0
drwxr-xr-x 3 root root 23 Mar 21 09:11 datastore
drwxrwx--- 1  988  988 24 Mar 21 08:02 nfs

The permissions change when I mount the share.
It seems that the user 988 is the "unifi-core" user in my Unifi NAS.

the user "backup" in my Unifi NAS:

Code:
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin

The user "backup" in my PBS:
Code:
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin

Except that both users have the same UID/GID

I have found this post:
https://forum.proxmox.com/threads/change-uid-gid-of-backups-user.175798/
 
Last edited:
Before mounting the NFS share inside your PBS VM you may want to set a immutable flag to the mount directory with chattr +i <directory>
If you don't do that and your NFS share is not mounted for whatever reason PBS may write data to this directory and fill up your VM space.
 
  • Like
Reactions: UdoB and _gabriel
Code:
root@pbs:/# chattr +i /mnt/nfs/

root@pbs:/# lsattr /mnt/
----i----------------- /mnt/nfs

Before mounted:

Code:
root@pbs:/# ls -l /mnt/
total 0
drwxrwx--- 2 backup backup 6 Mar 20 12:33 nfs

After mounted:

Code:
root@pbs:/# mount -a
root@pbs:/# ls -l /mnt/
total 0
drwxrwx--- 1 988 988 24 Mar 21 08:02 nfs
 
Code:
IP_add:/var/nfs/shared/shared_file on /mnt/nfs type nfs (rw,noatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,nolock,fatal_neterrors=none,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=IP_add,mountvers=3,mountport=53198,mountproto=udp,local_lock=all,addr=IP_add,_netdev)

Code:
IP_add:/var/nfs/shared/shared_folder /mnt/nfs nfs rw,_netdev,nofail,noatime,async,nolock,actimeo=0 0 0