|
From: Craig B. <cba...@us...> - 2004-10-08 06:42:45
|
"Nathan Affleck" writes:
> It's got to be possible, but it's not clear what needs to be done. I simply
> want to backup a specific directory under the Documents and Settings
> directory... For eg:
>
> $Conf{BackupFilesOnly} = '/Documents and Settings/*/My Documents';
>
> Now, I know this is a problem with smbclient. But it sounded like there was
> some ray of hope if one patched their smbclient with a specific regex hack?
> I'm running the smbclient from fedora core 2 (specifically
> samba-3.0.7-2.FC2). Was the tweak that has been mentioned incorporated into
> the FEDORA core rpm? How can you tell?
>
> OR, is the tweak some regex option that needs to be implemented during
> compile time (-Tr???) How? I didn't notice any --with-regex option with
> the latest samba release.
Unfortunately I don't believe you can't use a wildcard or regexp
in $Conf{BackupFilesOnly}. Yes, smbclient can be compiled with
HAVE_REGEX_H defined and then regexps can be used for exclude
arguments. However, I agree that HAVE_REGEX_H doesn't appear
in samba's configure, so I would guess you have to set it
manually.
I'm attaching some partially done FAQ on this issue.
Craig
###########################################################################
# Excluding and including files
=head1 How do I exclude and include particular files?
This is done with the two settings $Conf{BackupFilesOnly} and
$Conf{BackupFilesExclude}. $Conf{BackupFilesOnly} is the list
of directories or files to backup. Only these directories or
files will be backed up. $Conf{BackupFilesOnly} does not accept
wildcards.
$Conf{BackupFilesExclude} can be used to exclude particular directories
or types of files, eg:
$Conf{BackupFilesExclude} = '/proc';
$Conf{BackupFilesExclude} = ['/proc', '/tmp'];
$Conf{BackupFilesExclude} = ['*.mp3', '*.tmp'];
The exact behavior depends upon the XferMethod used. For example,
smb uses SmbClient, and it has limited capability for including and
excluding particular files. In particular, with smb:
=over 4
=item *
only a single option (either $Conf{BackupFilesOnly} or
$Conf{BackupFilesExclude} can be used.
=item *
very limited (dos-like) wildcards can be accepted. For example, this:
$Conf{BackupFilesOnly} = '/Documents and Settings/craig/My Documents';
will work as expected: only the given folder will be backed up. However,
this:
$Conf{BackupFilesOnly} = '/Documents and Settings/*/My Documents';
will not work.
=item *
smbclient only accepts a single $Conf{BackupFilesExclude} argument.
This is fixed starting in samba-3.0.3.
=back
=head1 How do I use rsync to include and exclude files?
Rsync and rsyncd provide the most flexible methods for including
and excluding files.
The basic features are supported by $Conf{BackupFilesOnly} and
$Conf{BackupFilesExclude}, as explained above. $Conf{BackupFilesOnly}
is relative to $Conf{RsyncShareName}. For example, if $Conf{RsyncShareName}
is /home, then:
$Conf{BackupFilesOnly} = ['/craig', '/bill'];
will backup only /home/craig and /home/bill. The same applies to rsyncd:
$Conf{BackupFilesOnly} is relative to the module directory. For example,
if a module called 'home' points to /home, then the above example will
backup only /home/craig and /home/bill.
$Conf{BackupFilesExclude} can use quite flexible wildcards. If an
entry starts with a '/' then it refers to an absolute path, rooted
at the $Conf{RsyncShareName}.
Significantly more general exclude and include options can be specified
by directly setting rsync arguments. See the rsync manual page for more
information.
For rsync, $Conf{BackupFilesOnly} and $Conf{BackupFilesExclude} are
implemented by converting them into the --include and --exclude
arguments to rsync. $Conf{BackupFilesExclude} converts directly
to --exclude arguments, and $Conf{BackupFilesOnly} might translate
to several --include and --exclude arguments so that just the
desired directories are included. See the rsync arguments in the
XferLOG file if you want to see the result of this translation.
It is possible to mix $Conf{BackupFilesOnly}, $Conf{BackupFilesExclude}
and additional arguments to rsync.
=head1 How do I backup just My Documents?
For a particular user, eg: craig, you can set:
$Conf{BackupFilesOnly} = '/Documents and Settings/craig/My Documents';
However, smbclient doesn't expand wildcards in the middle of paths,
so this will not work with smbclient to backup all the user's
My Documents folders:
$Conf{BackupFilesOnly} = '/Documents and Settings/*/My Documents';
If you want to use smbclient, one choice is to place all the user's
documents in a single folder, as suggested by Erich Vinson:
=over 4
=item *
make one folder, C:\docs
=item *
create sub-folders under that, C:\docs\user1 etc.
=item *
set permissions so that user1 can't access user2's folder, etc.
=item *
set each user's 'My Documents' location to point to the new folder,
answering 'yes' when asked if you want to move the files
=item *
create a user called 'backup'.
=item *
share C:\docs as 'docs' giving only the backup user permission on the
share (remember share permissions are different than NTFS permissions).
=item *
If Outlook is used, move the outlook.pst (and possibly archive.pst and
extend.dat) to the new location. Outlook will whine about not being able
to find its PST file, just point it in the right direction and it will
continue chugging right along.
=item *
Then just backup the 'docs' share on each machine. It has worked
extremely well for me.
=back
|