Skip to content

Proxmox Backup Server garbage collection takes 9 hours on a CIFS datastore: why, and how to design offsite PBS instead

PBS garbage collection crawling on a CIFS or NFS datastore such as a storage box? Why the mark-and-sweep design hurts on network shares, and how to build offsite PBS with pull sync or the S3 backend.

By Nishant Gauraw, NG-NeXTPublished Updated 8 min read

A question on r/Proxmox this week describes a setup that looks sensible on paper. Two Proxmox VE 9.2 nodes, about 20 guests, and Proxmox Backup Server (PBS) 4.2 on a mini PC with a 2×4 TB ZFS mirror holding about 1.4 TB after deduplication. For an offsite copy, the poster mounted a Hetzner Storage Box over CIFS as a second datastore. Backups landed fine. Garbage collection (GC) took about 9 hours, and verify jobs started running into the next night's backup window. After a month they gave up, and now they are choosing between a storage VPS running a second PBS that pulls from home, and the S3 datastore backend pointed at Backblaze B2.

The S3 backend is still often described as a technology preview; as shown below, PBS 4.2 ended that. This post explains why GC is slow on a network share, then lays out the two offsite designs using what the PBS documentation actually says.

How PBS garbage collection works#

PBS does not store each backup as one archive file. It splits the data into chunks, names each chunk by its SHA-256 checksum, and stores each chunk once, as a file under <datastore>/.chunks/. A snapshot is a small set of metadata files — a manifest, blobs, and one or more index files — and the indexes list the chunks it uses. The technical overview explains that the chunk directory is split into 65,536 subdirectories (0000 to ffff) by the first two bytes of the checksum, and that VM disks are typically cut into fixed 4 MiB chunks.

Because many snapshots share chunks, pruning a snapshot removes only its metadata (manifest, indexes, blobs, log and notes). The chunk space comes back when GC runs. The maintenance chapter describes two phases:

  • Phase 1 (mark): read every index file and update the access time (atime) of every chunk it references.
  • Phase 2 (sweep): iterate over all chunks and delete those whose atime is older than a cutoff — by default 24 hours and 5 minutes before GC started, or earlier if an older backup is still running. Chunks inside that grace period are reported as pending removals and go on a later run. The cutoff can be changed with the gc-atime-cutoff tuning option.

On a local disk this is metadata work: reading index files, utime-style atime updates, and walking directories. On a CIFS or NFS share, many of those metadata operations turn into requests to a server across the network; client-side caching helps with some of them, but an atime update has to reach the server. With hundreds of thousands of chunks, that can mean a very large number of round trips in phase 1, then a walk of 65,536 directories and a check of every chunk in phase 2.

To see why the hours add up, take an illustrative example — these numbers are assumptions, not measurements from the thread. Suppose a datastore holds 400,000 chunks and each metadata round trip to the share costs 20 ms. Touching every chunk once in phase 1 is 400,000 × 20 ms = 8,000 seconds, a bit over 2 hours. Checking every chunk once in phase 2 is another 2 hours or so. Add index reads, the directory walk, slow periods on a shared storage service, and verify jobs that read chunk data back over the same link (how much crosses the link depends on what is re-verified and on client caching), and a nightly window can disappear.

PBS 3.4 added an in-memory least-recently-used cache so phase 1 skips repeat atime updates for chunks it has already touched (while they are still in the cache), and a gc-cache-capacity tuning option to size it (default 1,048,576 slots, maximum 8,388,608), per the PBS roadmap release notes and the datastore tuning options. That helps when many snapshots share chunks. It does not remove the work of touching each chunk the first time, or the sweep.

The atime check exists for a reason#

GC depends on atime updates being honoured. If a filesystem silently ignores them, phase 2 can delete chunks that are still in use. Since PBS 3.4, datastore creation and GC run an atime safety check on a test chunk and report an error if the update is not honoured (roadmap; gc-atime-safety-check in the tuning options). The documentation recommends leaving it enabled, which is also the default. If a network share fails that check, do not switch the check off to make the error go away; move the datastore.

What Proxmox recommends for datastore storage#

The system requirements page is plain: "Prefer fast local storage that delivers high IOPS for random IO workloads; use only enterprise SSDs for best results." For spinning disks: "Using a metadata cache is highly recommended, for example, add a ZFS special device mirror."

Note the word local. A CIFS mount to a shared storage service is far from that recommendation. Even where a CIFS mount passes the PBS atime safety check, GC and verify pay the price.

Option 1: a second PBS offsite that pulls#

This is what the poster was leaning toward, and it follows the PBS design closely.

  • GC and verify run next to the disks. The offsite PBS owns its datastore, so phase 1 and phase 2 are local metadata operations, not network round trips.
  • Pull keeps credentials one-way. In a pull sync job the offsite PBS connects to the home PBS and reads from it (sync jobs). The home PBS needs no credentials for the offsite one. Give the offsite side an API token on the home PBS with read-only rights on the datastore; PBS ships a DatastoreReader role that "can inspect a datastore's or namespace's content and do restores" (user management). The documentation notes that a sync job only sees the backup groups that token can read.
  • Throttle and parallelise. rate-in limits a pull job's bandwidth, for example proxmox-backup-manager sync-job update ID --rate-in 20MiB. Since PBS 4.2, worker-threads (1 to 32, default 1) syncs several backup groups in parallel, which the docs say "can significantly improve throughput on high-latency connections." Memory and connection count grow with it, so raise it in steps.
  • Do not put the home PBS on the internet to make this work. PBS only needs the offsite box to reach the home PBS API; my advice is to give it that path over a WireGuard or IPsec tunnel between the two sites, not an open port.

The HDD question. The poster's worry is fair. In the poster's search, VPS plans with 2 TB+ at a sane price were mostly spinning disk, and PBS's own guidance for HDDs is a metadata cache such as a ZFS special device mirror. Check whether the plan you pick lets you add one. Before paying for a year, ask the provider whether SSD volumes can be attached for a ZFS special vdev — mirrored, because a special vdev holds pool metadata and losing it can lose the pool (PBS ZFS special device notes) — or pick a plan with SSD-backed storage for a smaller datastore. Then measure: run a GC on the offsite PBS after the first full sync and look at the duration in the task log. Local HDD metadata work avoids network round trips, but random seeks still cost time, so measure rather than assume.

Option 2: the S3 backend#

Since PBS 4.0, a datastore can live in an S3-compatible object store. In PBS 4.2 (released 29 April 2026) that backend "graduated from the technology preview phase and is now officially supported," with request statistics and notification thresholds (roadmap). Per the storage documentation:

  • An S3 datastore still needs a local persistent cache; 64 GiB to 128 GiB is recommended, ideally on a dedicated disk, partition or ZFS dataset with a quota.
  • Providers may charge for storage, API requests and egress, and Proxmox recommends monitoring those costs. GC and verify on an S3 store still do some work in the local cache, but GC also lists and deletes objects in the bucket, and verify fetches chunks that are not in the local cache. Depending on the provider, those requests and the egress can be charged.
  • A datastore cannot be shared between several PBS instances.

The trade-off to think about is credentials. With an S3 datastore attached to the home PBS, the home PBS holds the access key for the bucket. If home is compromised, so is that key. Whether your provider offers object lock or versioning that survives a stolen key, and how that interacts with PBS's own GC, is something to confirm with the provider and the PBS documentation before you rely on it.

Option 3 (PBS 4.2): push with server-side encryption#

PBS 4.2 also lets a push sync job encrypt snapshots before sending them to a remote PBS, which the release notes describe as useful for "instances in less trusted offsite locations" (roadmap). Push puts credentials for the remote on the home PBS, so it gives up the one-way property of pull. The docs strongly advise a dedicated remote configuration for each push sync job, with limited permissions on the remote side.

Schedule GC and verify so they do not collide#

From the maintenance chapter:

  • A weekly GC schedule "provides a good interval to start" for most setups.
  • Verify jobs default to 1 reader thread and 4 verify threads. Proxmox suggests a frequent job that checks new and expired snapshots, plus a weekly or monthly job that re-verifies everything.

On the offsite box: sync first, then verify new snapshots, then GC once a week in a window when nothing else runs.

What I would tell the poster#

Drop the CIFS datastore. On a high-latency shared storage service, GC and verify are likely to stay slow, and it is far from the local, high-IOPS storage PBS recommends. A pulling PBS offsite keeps credentials one-way and runs GC next to its disks. If that has to be HDD, ask the provider for mirrored SSD storage for a ZFS special vdev, or accept a smaller SSD-backed datastore. The S3 backend is now officially supported and is a reasonable second choice if you accept the provider's storage, request and egress pricing and plan how the bucket credentials are protected.

The know-how here stays free. If you want an offsite backup design for a whole estate — PBS, sync, retention and restore drills — planned or built for you, NG-NeXT does consulting and turnkey builds. Reach us through the contact page.

— Nishant Gauraw, Founder and CEO, NG-NeXT Tech

Talk to us directly.

We reply within one business day. The site assistant answers at any hour.