Borg create and recreate make empty archive --patterns-from option (help)
My version of borgbackup
$> borg -V
borg 1.2.0
My systeme
$> lsb_release -a
No LSB modules are available.
Distributor ID: Pop
Description: Pop!_OS 22.04 LTS
Release: 22.04
Codename: jammy
Hello, I've started trying borgbackup, and while using the --patterns-from option, I noticed that nothing gets saved. Nothing appears when I run a borg list on the archive:
$> borg list borg_backup::pop-os-unix_tty-2023-10-25
I've even tried to recreate an archive from scratch, and it's still empty:
unix_tty@pop-os:/media/unix_tty/Intenso
$> borg recreate -vs --progress --patterns-from patternfile.lst borg_backup::pop-os-unix_tty-2023-10-25
------------------------------------------------------------------------------
Repository: /media/unix_tty/Intenso/borg_backup
Archive name: pop-os-unix_tty-2023-10-25
Archive fingerprint: 20a1c9c41b362a316f9907c8d8bc42fbb14f073cb34ea79b897a7646a7e86586
Time (start): Thu, 2023-10-26 13:32:41
Time (end): Thu, 2023-10-26 13:32:42
Duration: 0.50 seconds
Number of files: 0
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
This archive: 677 B 534 B 534 B
All archives: 4.49 GB 3.58 GB 1.24 GB
Unique chunks Total chunks
Chunk index: 40209 115214
------------------------------------------------------------------------------
The contents of my patternfile.lst:
unix_tty@pop-os:/media/unix_tty/Intenso
$> cat patternfile.lst
P sh
R /home/unix_tty
+ bin
+ git-source
+ Desktop
+ Documents
+ Downloads
+ Music
+ Pictures
+ Videos
- pp:root
I've already tried other things, like putting exclusions at the beginning or just using an asterisk * as an exclusion, but nothing seems to work.
I want to back up only the contents of the following folders and not the rest:
~/bin, ~/git-source, ~/Desktop, ~/Documents, ~/Downloads, ~/Music, ~/Pictures, ~/Videos
Does anyone with all this information have an idea of what the problem might be ? Or how could I edit my patternfile.lst to make it work ?
Here's the documentation with the --patterns-from option, I've already consulted it:
https://borgbackup.readthedocs.io/en/stable/usage/help.html
1.2.0 is rather old meanwhile, maybe you should run a more recent version (it is important to read the change log): https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/borgbackup
When creating inclusion/exclusion patterns, you can use borg create --dry-run --list ... to immediately see what's included or excluded.
Also, recreate is to modify an existing archive (based only on its current contents, it will never get content added from the fs), it is not "recreate it from scratch" (from the filesystem).
About your patterns: try prefixing them with home/unix_tty/ .
Hello, sorry for the wait.
I've updated my borg
$> borg -V
borg 1.2.6
I searched a fast and convenient way for install the last version when I found and installed (with pip) I saw that you had already given me what I needed(the link) Now, I've added the ppa
Also,
it turns out that I had tried to rename my user session,
thinking that the hyphen (-) in /home/unix-tty
might cause problems with the --patterns-from option.
However, my /home/unix-tty folder was not renamed after I used
usermod -l unix_tty unix-tty as root
The same goes for /media/unix_tty
I created it thinking it was missing,
so the line R /home/unix_tty was not working.
I've corrected it, but the first pattern file still resulted in empty archives.
I tested a patternfile2.lst
it works very well
$> cat patternfile2.lst
# P sh
R /home/unix-tty
- **/.git
+ /home/unix-tty/bin
+ /home/unix-tty/git-source
+ /home/unix-tty/Desktop
+ /home/unix-tty/Documents
+ /home/unix-tty/Music
+ /home/unix-tty/Pictures
+ /home/unix-tty/Videos
- /home/unix-tty
However, patternfile.lst still results in empty archives. I'd like to know the reason because the documentation seems to suggest that it should work . Is it just a bug, or does the documentation need an update, or is it something else ?
$> cat patternfile.lst
# P sh
R /home/unix-tty
- **/.git
+ bin
+ git-source
+ Desktop
+ Documents
+ Downloads
+ Music
+ Pictures
+ Videos
- **
patternfile2 looks almost ok, but guess you need to get rid of the leading slash in the patterns.
patternfile can't work as there is no relationship between the recursion roots (R) and the patterns (+, - and !) - so you can't specify the latter as relative to the first.
Guess this is solved.