How do I exclude directories from garbage collection?

Apr 30, 2025
4
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.