From owner-freebsd-questions@FreeBSD.ORG Thu Jul 28 16:39:07 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E051106566B for ; Thu, 28 Jul 2011 16:39:07 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id E3DB98FC12 for ; Thu, 28 Jul 2011 16:39:06 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id p6SGdA1O002584; Thu, 28 Jul 2011 11:39:10 -0500 (CDT) Date: Thu, 28 Jul 2011 11:39:10 -0500 (CDT) From: Robert Bonomi Message-Id: <201107281639.p6SGdA1O002584@mail.r-bonomi.com> To: admin@prnet.org In-Reply-To: <752d3bc32283c9955f56b7320f700b1e.squirrel@www.prnet.org> Cc: freebsd-questions@freebsd.org Subject: Re: disappearing files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 16:39:07 -0000 > Date: Thu, 28 Jul 2011 12:30:36 +0200 > From: admin@prnet.org > Subject: Re: disappearing files > > Hi, > > Dmesg returns no error. Also smartctl returns no errors. I will wait for > other suggestion before unmounting the volume in this machine for the case > someone else has another suggestion what to check for, because it might be > that by umounting and remounting, it will take again a few month for the > problem to reappear. > > On the other machine that was having the problem, dmesg and smartctl also > returned no errors. I rebooted the machine and started fsck which also > returned no error. On remounting, everything was working again. When the problem shows up again, run the following script, as superuser, from inside the jail environment. It requires one argument -- the fully qualified path name of the 'disappeared' file. #!/bin/sh if [ $# -lt 1 ] ; then echo "Usage: $0 pathname" echo " 'pathname' MUST be spcified" echo exit 1 fi if [ $# -gt 1 ] ; then echo "Usage: $0 pathname" echo " only one 'pathname' allowed (\"$*\" is invalid)" echo exit 1 fi dir_name=`dirname $1` export dir_name file_name=`basename $1 | sed -e 's/[.]/\\//'` export file_name file_name=`dirname $file_name` fs_name=`echo f* | tr ' ' '\n' | head -1` fs_name='df ${fs_name} | tail -1 | cut -d ' ' -f 1' sync; sync # this just minimizes fsck 'chatter' echo echo 'fsck output:' yes |fsck -n ${fs_name} # don't fix anything, continue if asked echo echo 'ls output:' ls -l ${dir_name}/${file_name}* echo echo 'stat output:' stat ${dir_name}/${file_name}* echo echo 'stat -L output:' stat -L ${dir_name}/${file_name}* echo echo 'lsof output:' lsof | grep ${file_name} This will show _all_ the relevant info for the file(s) and filesystem. Run it when things misbehave, _and_ when things are working properly. Differences should prove very informative. Do -not- be suprised if 'fsck' reports inconsistencies -- such are to be expected on an 'active' filesystem. However, the list of "inconsistencies" _can_ be useful if 'something unexpected' shows up there.