How do I exclude directories from garbage collection?

Apr 30, 2025
7
0
1
Code:
Datastore: ds01

Garbage collection failed: cannot continue garbage-collection safely, permission denied on: "/dev-pool/restic"

I didn't setup this PBS but it seems someone has pointed it to use our entire zfs pool, so whatever subvolumes I create end up creating these errors. Is there a way to exclude a directory from garbage collection to avoid the error?
 
Code:
Datastore: ds01

Garbage collection failed: cannot continue garbage-collection safely, permission denied on: "/dev-pool/restic"

I didn't setup this PBS but it seems someone has pointed it to use our entire zfs pool, so whatever subvolumes I create end up creating these errors. Is there a way to exclude a directory from garbage collection to avoid the error?
You cannot exclude subdirectories from garbage collection. What you should do instead is change the mountpoint for your datastore so other datasets do not get mounted in it.

You can set the datastore to maintenance mode offline in the Datastores Options tab so no active operations are performed on the datastore. Then you unmount the zfs dataset via a zfs unmount <datastore-dataset> create an new mountpoint under /mnt/datastore/<store-name>, setting ownership and group to backup, change the mountpoint for the datastore-dataset to the new mountpoint via zfs set mountpoint=/mnt/datastore/<store-name> <datastore-dataset> and mount it again via zfs mount <datastore-dataset>.

Finally, you deactivate the maintenance mode again.
 
Sorry I was completely wrong here. The garbage collection emails are from another server.

And on that server I truly have no datasets in the zfs pool, so the datastore is directly in the root of the pool.

I figured it out myself, there is a datastore.cfg file under /etc/proxmox-backup that sets the path.

So I will create a new zfs set called pbs-data, set the datastore into maintenance mode, change datastore.cfg to point to the new dataset.

Then I have to restart pbs? Or what?
 
Last edited:
Above output does not match what you posted initially?
"/dev-pool/restic"
So either your datastore is configured to use a completely different moutpoint or you are symlinking it?

Please share the output of cat /etc/proxmox-backup/datastore.cfg, ls -la /dev-pool/ and mount
 
Above output does not match what you posted initially?

So either your datastore is configured to use a completely different moutpoint or you are symlinking it?

Please share the output of cat /etc/proxmox-backup/datastore.cfg, ls -la /dev-pool/ and mount
Ugh sorry I've been troubleshooting while writing this post so first of all I was wrong.

The GC warnings were from a different server.

And now I figured out the problem.

And on that server I truly have no datasets in the zfs pool, so the datastore is directly in the root of the pool.

Code:
$ sudo cat /etc/proxmox-backup/datastore.cfg
datastore: ds01
        comment
        gc-schedule 22:00
        notify gc=error,sync=error,verify=error
        notify-user backupAdmin@pbs
        path /dev-pool

So I will create a new zfs set called pbs-data, set the datastore into maintenance mode, change datastore.cfg to point to the new dataset.

Then I have to restart pbs? Or what?
 
So I will create a new zfs set called pbs-data, set the datastore into maintenance mode, change datastore.cfg to point to the new dataset.

Then I have to restart pbs? Or what?
That will not work unless you also sync the contents of the datastore to the new dataset.
 
That will not work unless you also sync the contents of the datastore to the new dataset.
Yes to be clear this is what I'm doing right now.
  1. Set the datastore into maintenance mode.
  2. Create a new zfs dataset /dev-pool/pbs-data
  3. Sync all PBS directories, including dot-directories, from /dev-pool to /dev/pool/pbs-data
  4. Change the datastore directory with proxmox-backup-manager datastore update ds01 --path /dev-pool/pbs-data
  5. Now at this point I'm a little iffy, do I just restart the service with systemctl restart proxmox-backup-proxy.service?
  6. Set datastore into online mode
 
Change the datastore directory with proxmox-backup-manager datastore update ds01 --path /dev-pool/pbs-data
This will not work, as the update subcommand does not provide a path. You will have to edit the contents of /etc/proxmox-backup/datastore.cfg instead. Please make sure you do not add/delete unintended contents and make a backup before editing it.

Now at this point I'm a little iffy, do I just restart the service with systemctl restart proxmox-backup-proxy.service?
This is not required. When setting the datastore into offline mode, the Proxmox Backup Server disregards it until it comes back by disabling the maintenance mode again.