Prune on Backblaze B2 Leads to "No Space" Error

I tried to use prune today with my repository on Backblaze B2 but got an error message:

Fatal: Write: write /tmp/restic-temp-pack...no space left on device

Immediately before, I had been able to run backup and forget commands on the same repository, without a problem. Past prune operations have also been successful.

After checking this forum and github, I suspected a cache issue. I was able to complete the prune operation successfully (and slowly) using prune --no-cache. However, this option is not attractive for general use as online literature suggests a failure during the prune operation could corrupt the entire repository.

I’m wondering if this issue stems from my cache or the B2 storage system, or something else altogether. I’d like to know how to do safe pruning operations on B2 without this issue. TIA

Sounds like There is not enough space on your local disk (/tmp) to do the job with caching.

Either free some space or redirect the cache location to somewhere else using --cache-dir

You are correct, you need a large local cache dir to run the prune. (It is also used during backups).

On my Debian Linux system, the cache is in /root/.cache/restic and is 32G in size. I have used a symlink so the data is actually stored in /var/cache/restic where there is a mounted volume to store the data.

You can see details of the cache with the restic cache command:

root@jupiter:~# restic cache
Repo ID     Last Used   Old  Size
----------------------------------------
9269d27730  4 days ago         4.468 GiB
0690ace3b1  1 days ago         1.678 GiB
ad51e4d38f  0 days ago        10.880 GiB
c189ee3eb1  0 days ago        14.416 GiB
----------------------------------------
4 cache dirs in /root/.cache/restic

Thanks - it helps to know that prune requires significant local cache space. Having achieved a prune (using --no-cache), it’s hard for me to replicate the problem now. I routinely set a custom cache directory for restic:
export XDG_CACHE_HOME="/share/CE_CACHEDEV1_DATA/homes/admin/ResticCache"
…and the cache command reveals:

[~] # restic cache
Repo ID     Last Used   Old  Size
----------------------------------------
4e40fc3312  0 days ago        64.265 MiB
----------------------------------------

I have checked disk availability using df -h and I have more than 800GB of disk space on that filesystem. So, I’ll wait till problem re-manifests, if it does. Maybe I just had a transient disk access issue - who knows. Thanks for the info/support.

There is no problem with the cache here! This error message come from the fact that prune sometimes needs to repack pack files. To do so, they are temporarily saved in your temp dir. And this obviously ran out of space.

So this is only connected to the cache dir used by restic if your cache is also saved under the /tmp/ dir or shares the same ressources (e.g. both being in-memory mounts).

But - still, your considerations about the cache dir are valid, only not the root cause of the failure mentioned here.

2 Likes

It’s possible to specify a different temp directory by setting the environment variable TMPDIR.

Thanks @alexweiss - a very useful clarification!

Thanks for the tip @MichaelEischer