[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Confusion about including and excluding files in tarsnap.conf versus the command line
- To: Craig Hartnett <craig@1811.spamslip.com>
- Subject: Re: Confusion about including and excluding files in tarsnap.conf versus the command line
- From: Graham Percival <gperciva@tarsnap.com>
- Date: Thu, 8 Nov 2018 18:07:13 -0800
- Cc: tarsnap-users@tarsnap.com
- In-reply-to: <1541726412.2640.39.camel@wrathall>
- References: <1541726412.2640.39.camel@wrathall>
On Thu, Nov 08, 2018 at 05:20:12PM -0800, Craig Hartnett wrote:
> Just signed up
Welcome!
> (e.g., tarsnap --dry-run --print-stats --humanize-numbers
> -c /media/USER/PATH
> --exclude /media/USER/PATH/.Trash-1000 /media/USER/PATH/lost
> +found /media/USER/PATH/OTHER-EXCLUDED-DIRECTORY)
Careful there! "--exclude" only accepts a single value. If you want to
exclude multiple values on the command-line (which is not recommended;
I would definitely put them in your config file), you would need:
--exclude /media/USER/PATH/.Trash-1000
--exclude /media/USER/PATH/lost+found
--exclude /media/USER/PATH/OTHER-EXCLUDED-DIRECTORY
> So here I am today and now wanting to run my first real back-up and I'm
> stuck on the same problem. The information in step 1A at
> http://www.tarsnap.com/simple-usage.html still seems to require me to
> put my list of included and excluded paths on the command line. Why is
> this? Why doesn't tarsnap just get the list from tarsnap.conf?
Hmm, I'll tweak simple-usage.html somewhat. tarsnap does indeed get the values
from tarsnap.conf, with three exceptions:
-c: tarsnap doesn't know which mode (create/extract/test/etc.), so we need to
give this on the command-line
-f "$(uname -n)-$(date +%Y-%m-%d_%H-%M-%S)": since the archive name changes
every day, we need to give it here.
/MY/DATADIR: we need to give the "root" directory to include (running
"tarsnap -c -f foo" doesn't work, even if we have an "include bar"
in the config file).
> exclude /media/USER/PATH/.Trash-1000
> exclude /media/USER/PATH/lost+found
> exclude /media/USER/PATH/_hold
>
> include /media/USER/PATH
> include /home/USER
> include /etc
> include /opt
Please delete the "include" lines, then use this command-line:
/usr/local/bin/tarsnap -c \
-f "$(uname -n)-$(date +%Y-%m-%d_%H-%M-%S)" \
/media/USER/PATH \
/home/USER \
/etc \
/opt
(apologies for the confusing name of "--include"... it should really be
"--include-only". Unfortunately the name came from the 1980s-era tar(1)
program, is still in use nowadays, and we don't want to break backwards
compatibility with the expected behaviour of tar(1).)
For more information, please see:
http://www.tarsnap.com/selecting-files.html
including the warnings about trying it with --dry-run before doing a real
backup. I think that in your case, you don't need "include" at all.
Cheers,
- Graham
PS: I almost recommended that you kept the "include" lines and tried:
/usr/local/bin/tarsnap -c \
-f "$(uname -n)-$(date +%Y-%m-%d_%H-%M-%S)" \
/
However, when I was just about to send the email, I noticed:
- The process of recursing into subdirectories is also affected. Adding this
to the config file:
include /home
and then attempting to back up / results in nothing being backed up.
http://www.tarsnap.com/selecting-files.html
So clearly I already made that mistake a few years ago when I was writing that
page!
- Graham