Amanda-Users

Samba loses files from directories, backups defective

2005-02-25 15:31:52
Subject: Samba loses files from directories, backups defective
From: Kevin Dalley <kevin AT kelphead DOT org>
To: amanda-users AT amanda DOT org
Date: Fri, 25 Feb 2005 12:21:56 -0800
There is a very serious and long-standing problem with samba, where it
loses files from directories, perhaps 1-10 out of a 1000.  This
problem may cause amanda to miss files in a backup.  This problem may
be more likely to occur with directories which contain over 1000
files, though it has been reported in directories with 300 files.  The
problem has shown up with Windows 2000 and Windows XP, and probably
other releases of Windows as well.

Here's an excerpt from a bugzilla report which explains the problem:

       I have seen this behaviour a number of times too, especially
       when the no of entries in a dir is > 1000 (not a typical
       testing scenario). And not just with Windows XP but with
       earlier Win versions too. I believe this is not due to some
       incorrect implementation of the CIFS protocol. The dir listing
       functionality in samba depends on the CIFS server to maintain
       state information (how many dir- entries have been passed to
       the client in FIND_FIRST/NEXT responses so far, and where to
       resume listing from for the next FIND_NEXT request). However,
       it is completely possible that the CIFS server doesn't handle
       this properly and skips files at random now and then.

       There is an alternative, we maintain stat info (last file
       received) and send this to the CIFS server in the next request
       so it can start listing from the next file. I have tried this
       fix on samba-3.0.9 and it seems to work.  I am figuring out how
       to get this patch in to the samba subversion.


The bugzilla web page listed below has a patch for amanda which seems
to fix the problem.  The patch passed my non-amanda tests which I
include below.  I'm running some backups now to see if the files stop
disappearing when using amanda.

My test script examines a directory with 1194 files.  In a run of the
script, smbclient finds between 1189 and 1194 files on various runs.
Sometimes 10 files are lost.  This test script is borrowed from one of
the bugzilla reports.

for num in 1 2 3 4 5 6 7 8 9; do smbclient '\\puffin\c$' -U 'amanda%password' 
-E -d1 -Tca /dev/null  '/Kathy/DATA/2120 WNmod/*' > /tmp/foo/foolog$num.txt 
2>&1; done
for num in 2 3 4 5 6 7 8 9; do diff -u /tmp/foo/foolog1.txt 
/tmp/foo/foolog${num}.txt; done


When I looked over my amanda backups with this one large directory
with 1194 files, I found that files are sometimes missed, though the files
may be there on other backups.

Here's one of many references to this samba problem.

https://bugzilla.samba.org/show_bug.cgi?id=2271

Bug number 1304 and 2063 also mention the problem.  The problem seems
to have been around since at least 2002, here's a report from that year:

http://lists.samba.org/archive/samba/2002-June/046209.html



-- 
Kevin Dalley
kevin AT kelphead DOT org

<Prev in Thread] Current Thread [Next in Thread>
  • Samba loses files from directories, backups defective, Kevin Dalley <=