[Pkg-samba-maint] Bug#473651: [samba] Add a regular backup of .tdb files

Erik Rossen rossen at rossen.ch
Sun Aug 23 21:02:31 UTC 2009

Package: samba
Version: 2:3.2.5-4lenny6
Followup-For: Bug #473651

On Wed, 16 Apr 2008 23:08:20 -0700, Steve Langasek <vorlon at debian.org> wrote:
> Actually yes, I do object because I don't think we should be doing piecemeal
> backups in individual packages.  Losing winbind_idmap is bad, but not worse
> than losing other databases on the system, and I haven't seen that tdbs are
> noticeably more fragile than other database formats that they should require
> a separate backup policy from the rest of the system.

I just spent an hour modifying and testing the pre-existing
/etc/cron.daily/samba to backup the /var/lib/samba/*.tdb files to
/var/backups/samba on a number of Samba servers that I manage.

If /etc/samba/smbpasswd is important enough to backup, then so is secrets.tdb,
winbind_idmap.tdb, and all of the others.

My goal in the attached script is to provide a reasonable chance of recovery in
case /var/lib/samba gets blown away.  Use it if you like, ignore it if you

One other point: many well-meaning sysadmins may be doing rsync backups of
their entire systems, including /var/lib/samba, thinking that they are safe in
case of any catastrophe.  But they might not be aware that the modification
date on the *.tdb files rarely gets changed, even if the contents do, because
Samba uses mmap() to access them.  As a result, rsync might pick up the *.tdb
files the first time they are seen and then never again.  At least by running
tdbbackup regularly, one can guarantee that rsynced *.tdb.bak files are
somewhat up-to-date.

Personally I do not see anything wrong in supplying a minimal backup procedure
as part of a package.  Perhaps it should not be installed into /etc/cron* by
default, but that is another subject.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba
Type: text/x-shellscript
Size: 683 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20090823/dbc18b04/attachment.bin>

More information about the Pkg-samba-maint mailing list