[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Home made backup system



On 2019-12-25 08:42, Franco Martelli wrote:
On 18/12/19 at 18:02, rhkramer@gmail.com wrote:
Aside / Admission: I don't backup all that I should and as often as I should,
so I'm looking for ways to improve.  One thought I have is to write my own
backup "system" and use it, and I've thought about that a little, and provide
some of my thoughts below.
...

I was amazed that nobody yet considered tar. My backup with tar is based
to a script that invoke tar reading two hidden file .tarExclude and
.tarInclude:

~# cat .tarExclude
/home/myuser/.cache
/home/myuser/.kde
/home/myuser/.mozilla/firefox/xxxxxxxx.default
/home/myuser/VirtualBox\ VMs
/home/myuser/Shared
/home/myuser/Sources
/home/myuser/Video
/home/myuser/Scaricati
/home/myuser/Modelli
/home/myuser/Documenti
/home/myuser/Pubblici
/home/myuser/Desktop
/home/myuser/Immagini
/home/myuser/Musica
/home/myuser/linux-source-4.19

~# cat .tarInclude
/home/myuser
/root/
/etc/
/usr/local/bin/
/usr/local/etc/
/boot/grub/grub.cfg
/boot/config-4.19.67

then the script invoke tar command this way:

/bin/tar -X /root/.tarExclude -zcpvf /tmp/$f -T /root/.tarInclude

$f variable is the filename that it'll be moved to USB stick once tested
with the command:

/bin/tar ztf /tmp/$f >/dev/null

one thing you must take care is that the -X switch must came before of
the -T switch otherwise tar command fails.
HTH


tar(1) is very flexible:

1. I tend to formulate my archive jobs by host and (sub-)directory -- e.g. tinkywinky:/home, cvs:/var/local/cvs, etc..

2. Within each archive job, I include everything by default and then specify what to exclude via the various --exclude* options.

3. For a given host and directory, I may have multiple archive jobs that are run at different frequencies (daily, weekly, monthly, etc.). Frequent jobs exclude the most files and infrequent jobs exclude few (or none).

4. The --exclude-tag* options have the advantage (and risk) that the administrator(s) and user(s) can maintain archive exclusion tag files (e.g. ".noarchive") throughout the live filesystem as archiving requirements change over time. This reduces or eliminates the need for the administrator to make changes to the archiving scripts, configuration files, and job files.

5. All that said, I do have one VPS whose archive job is inverted by design -- based at root, exclude everything by default, and specify what to include via the --files-from option.


David


Reply to: