File Cache Problem
I encountered the Issue that the file cache on all my repositories vanished / at least is not used anymore. I did not change my config for a while so i thought the issue was what i wrote below as it pretty much alligned with 20 weekly backups so far.
Borg Version: 1.0.7 (via pip) OS: Ubuntu 16.04 LTS up2date
Backing up from from a local mounted samba share: type cifs (rw,relatime,vers=1.0,cache=strict,username=myuser,domain=MYSERVER,uid=1000,forceuid,gid=1002,forcegid,addr=127.0.0.1,file_mode=0665,dir_mode=0775,nounix,serverino,mapposix,nobrl,mfsymlinks,rsize=61440,wsize=65536,actimeo=1
over SSH to Borg Version: 1.0.7 (binary) Openmediavault 2.2.6 / Kernel 3.16.0 On (ST8000AS0002) ext4
If I check my file cache its still here e.g.
myuser@ubuntu:ls -la /mnt/cache1/.borg_cache/2023795930eb3938023d969420a8ac8d8c58122b86beda9c09d31ecfcd1f11a6
insgesamt 193228
drwx------ 1 myuser myuser 98 Sep 26 12:05 .
drwxrwxr-x 1 myuser myuser 896 Sep 26 04:05 ..
drwx------ 1 myuser myuser 2816 Sep 26 04:05 chunks.archive.d
drwx------ 1 myuser myuser 34 Sep 26 12:05 txn.active
-rw------- 1 myuser myuser 96336214 Sep 26 04:05 chunks
-rw------- 1 myuser myuser 318 Sep 26 04:05 config
-rw------- 1 myuser myuser 101519340 Sep 26 04:05 files
-rw------- 1 myuser myuser 20 Sep 26 04:05 README
myuser@omv:/media/d7e382f2-5492-465c-b8c8-f2f158b04486/Filme/borg$ ls
config data hints.10550 index.10550 README
myuser@omv:/media/d7e382f2-5492-465c-b8c8-f2f158b04486/Filme/borg$ cat config
[repository]
version = 1
segments_per_dir = 10000
max_segment_size = 524288000
id = 2023795930eb3938023d969420a8ac8d8c58122b86beda9c09d31ecfcd1f11a6
So the Cache is here but its not using it for some reason.
And heres how I do the Backup:
export BORG_CACHE_DIR="/mnt/cache1/.borg_cache"
REPO="omv:/media/d7e382f2-5492-465c-b8c8-f2f158b04486/Filme/borg"
NAME="filme-`date +%Y-%m-%d-%H_%M`"
touch /mnt/samba/Filme/.borg_touch
borg create --debug -v --list -s -x --chunker-params 19,23,21,4095 --ignore-inode \
$REPO::$NAME \
/mnt/samba/Filme \
EDIT: Disregard whats following below in this post the issue seems to be another one.
I was wondering why my Multiple TB Backup took so long and encountered the reason was the TTL in the cache.
This is in most cases a total reasonable behavior but in my use case and probably other peoples aswell this might be a problem when the backup is not taking 10-15 min but over a day when it rechunkifies everything.
One Solution would be to set BORG_FILES_CACHE_TTL to 99999 and do create with ignore cache option once in a while.
However I would suggest another concept:
We rechunk only some of the Files to keep the backuptime consistent.
BORG_FILES_CACHE_TTL_MIN=20 and BORG_FILES_CACHE_TTL_MAX=50
And an example how it would work asuming these Files in the cache:
File1 TTL=30 -> randint(20,50) -> 20 -> File will be rechunked and TTL set to 0 File2 TTL=30 -> randint(20,50) -> 25 -> File will be rechunked and TTL set to 0 File2 TTL=30 -> randint(20,50) -> 35 -> File will not be rechunked and TTL set to 31 File4 TTL=50 -> randint(20,50) -> 50 -> File will be rechunked and TTL set to 0
This way only a portion of the whole data will be rechunked but we still make sure that after 50 backups every file was at least rechunked once.
I also just opened a pull request: https://github.com/borgbackup/borg/pull/1645
I think we should first start with the problem definition before trying to solve it.
So, what is your problem? You also referred to "my use case", but you did not say what it is / what's special about it.
As I understood, borg re-chunks frequently for you, so that should be solvable by increasing the TTL so it is larger than the amount of backup sets on that machine.
As I understood, borg re-chunks frequently for you, so that should be solvable by increasing the TTL so it is larger than the amount of backup sets on that machine.
Increasing the TTL will only move the "Issue" into the future one might argue why the file cache has even a TTL.
So, what is your problem? You also referred to "my use case", but you did not say what it is / what's special about it.
My use case if that I have > 1 TB of data and every 20 Backups the Backup takes significantly longer because the whole cache is voided at once.
a problem when the backup is not taking 10-15 min but over a day when it rechunkifies everything
I try to make it more clear what the issue is:
If you have a huge amount of data the initial Backup takes a long time. Lets say e.g. 1 day. Following Backups will be really fast e.g. 15min for the same amount of huge data as they use the file cache.
After 20 backups the TTL on the file cache is reached. That means the Backup that used to take 15 min takes 1 day or even longer not to mention reading a huge amount of data in a short time.
My improvment changes that behaviour. After 20 Backup not all the files in the cache will vanish but only some (with BORG_FILES_CACHE_TTL_MAX=50 | 100 / 30 = 3,3 % to be precise)
This means at the next Backup it will only rechunk some of the files making the Backup still fast (as it rechunks only a part of your data) while still making sure that after 50 backups every file was rechunked at least once.
If you do 20 backups of same stuff, the TTL will NOT be reached as the files show up each time - and that resets their counter to 0. Only "not seen" files will have increasing TTL values.
OK that is really really strange. All my Backups that ran at the same intervall suddenly are rechunking everything again. I was almost certain that this explained it because I just reached no. 20.
Is there any way to quickly look at the File Cache for a given File x?
I saw somewhat similar things, but these were issues outside of Borg. Ie. programs messing with files and timestamps.
After https://github.com/borgbackup/borg/issues/624 which lead to the --ignore-inode option for smb/sshfs I'm 100% sure the files did not change.
Is there a way I can look at the file cache and compare that manually to the output of stat for a given file?
@fsironman no builtin way. while we could code a debug command to dump the files cache, I am not sure it is really worthwhile doing that. more important would be a way to reproduce the problem, if there is any.
@fsironman btw, please edit your first post and give borg version, operating / file system details.
I edited the first post and also added the output detailing the cache.
I'm not that familiar with python but if you can point me on how to add some debug messaged to the code where its checks for the file cache I could try to narrow it down.
borg/archive.py process_file, see cache.file_known_and_unchanged(). borg/cache.py commit, see self.files.
Sadly I cant reproduce the Issue anymore as it rechunked everything but I seem to have the same Issue as here: #1675 which could mean that by some unknown factor the cache got corrupted.
After digging trough the logfiles i noticed some ext4-fs errors which could explain that behavior. I'm convinced that the issue was indeed a bad disk. As I have ECC-RAM this is pretty much the only thing thats left.