Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2011 11:39:10 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        admin@prnet.org
Cc:        freebsd-questions@freebsd.org
Subject:   Re: disappearing files
Message-ID:  <201107281639.p6SGdA1O002584@mail.r-bonomi.com>
In-Reply-To: <752d3bc32283c9955f56b7320f700b1e.squirrel@www.prnet.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> 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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107281639.p6SGdA1O002584>