On Wed, Jun 26, 2019 at 16:57:33 +0100, Nuno Dias wrote:
> But if I have something like this
>
> ----------------------------------
> MACHINE /dir {
> tar
> exclude "./subdir/*"
> }
>
> MACHINE /dir/subdir /dir {
> tar
> include "./subdir/*"
> }
> ----------------------------------
>
> the commands
>
> $ amdump CONF MACHINE ^/dir$
> and
> $ amdump CONF MACHINE =/dir
>
> Don't work as expected, both backups (/dir and /dir/subdir) are made
>
> From "man disklist"
>
> diskname
> The name of the disk (a label). In most case, you set your diskname
> to the diskdevice and you don't set the diskdevice. If you want
> multiple entries with the same diskdevice, you must set a different
> diskname for each entry. It's the diskname that you use on the
> commandline for any Amanda command. Look at the example/disklist
> file for example.
>
> So from this, if it's the diskname that is used in the command, it
> seems that the reality is amdump is using the diskdevice instead!!
Thanks for the additional info, which certainly helps explain what is
happening to you....
My understanding of the inner workings of this part of Amanda is quite
fuzzy, but assuming I have followed the program flow behind "amdump"
correctly, it looks like the code in question is found in
server-src/diskfile.c:match_disklist() , which contains the following
lines:
if ([...] &&
(match_disk(sargv[i], dp->name) ||
(dp->device && match_disk(sargv[i], dp->device)))) {
..so I believe that in fact arguments specified on the amdump command line
are matched against BOTH the "diskname" and "diskdevice" fields, and if
either one matches the argument then that DLE is selected.... (which I
agree doesn't match the wording of the manpage....).
(As far as I can tell from git, this code has been like that since
at least 2006.)
In this particular example I think you could work around the problem by
changing your disklist to
----------------------------------
MACHINE /dir {
tar
exclude "./subdir/*"
}
MACHINE /dir/subdir {
tar
}
----------------------------------
(in which case presumably using either ^/dir$ or =/dir would not match
the second DLE) ... but obviously that doesn't help if you ever want to
have a DLE which uses "include" to pull in multiple subdirectories of
/dir.
I guess another possible solution is to using disknames of a form that
are designend to be unique, e.g. something like (not tested)
> ----------------------------------
> MACHINE dir-main /dir {
> tar
> exclude "./subdir/*"
> }
>
> MACHINE dir-subdir /dir {
> tar
> include "./subdir/*"
> }
> ----------------------------------
... and use those disknames on the amdump command line... (But you
have to choose disknames carefully so your Amanda Mail Report looks
reasonable, etc.)
Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway - [email protected] - Mid-Atlantic region
Ray Ontko & Co. - Software consulting services - http://www.ontko.com/
GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt ID: 1023D/ECFB6239
Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239