Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2006 04:09:19 +0200
From:      Helmut Schellong <var@schellong.biz>
To:        Tilman Linneweh <arved@FreeBSD.org>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Message-ID:  <446FCBCF.800@schellong.biz>
In-Reply-To: <200605201138.k4KBckvO059535@freefall.freebsd.org>
References:  <200605201138.k4KBckvO059535@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Tilman Linneweh wrote:
> Synopsis: umount: unmount of /card failed: Device busy ?!
>
> State-Changed-From-To: open->feedback
> State-Changed-By: arved
> State-Changed-When: Sat May 20 11:35:52 UTC 2006
> State-Changed-Why: 
> You need to add more information to make your PR useful.
>
> Not everyone knows that /dev/da1 is your ZIP drive.
> Did you verify that no files are open on /card (fstat(1), lsof)
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=97513
>
>   
/dev/da1 (s2,s1) ist a CompactFlash Card 8 GB. Sometimes da0.

At the time of the message "Device busy" I had not run
any other process that accessed /dev/da1. The script safecard only.
Before the runtime of the script the filesytem on Card was unmounted.

safecard:
=======================================================================
#!/u/bin/bsh

MDIR=/card
[ -d "$MDIR" ] || mkdir "$MDIR"
LST='/boot /home /root /u /dos/cie'
[ -n "$*" ] && LST="$*"
camcontrol devlist | grep -m '19>.%{5,}da[0-9]' | readl Z || { echo 
camcontrol; exit 1; }
set DEV:.50
expr "$Z" :DEV '%(%<da[0-9]%{1,2}%>%)' || { echo "expr da#"; exit 2; }
DEV="/dev/${DEV}s2"
[ -c "$DEV" -o -b "$DEV" ] || { echo "DEV=$DEV"; exit 3; }
echo "Kartengerät: $DEV"

safe.bsh "$DEV" "$MDIR" "$LST" || echo "$0: -> safe.bsh: Exit=$?"
:


safe.bsh
==============================================
#!/u/bin/bsh

TMP=/tmp/safe_$$
[ $# -ne 3 ] && exit 1
[ ! -e "$1" -o ! -d "$2" -o -z "$3" ] && exit 2
DEV="$1" MDIR="$2" LST="$3"
C="$0"
expr "$0" :C '%([^/]%{1,}%)$'
echo "%n$C: TMP=$TMP"
echo ----------------------------------------------------------------
M=0
mount > $TMP || exit
grep -q "$DEV .%{2,} $MDIR " $TMP || M=1
[ M -eq 1 ] && mount -v $DEV $MDIR || exit
sleep 3
set DIR:.500 F:.1000

for DIR in $LST
do
   [ -d $DIR ] || continue
   echo "$C: $DIR ..."
   find $DIR -print > $TMP
   [ -s $TMP ] || continue
   <$TMP
   while readl F
   do
      if [ -L "$F" ]
      then
         [ -f "$F" -o -d "$F" ] || {
            echo "$C: Typ != -f -d: $F"; continue
         }
         fstat -tv T "$F" || {
            echo "$C: Gebrochener Link: $F"; continue
         }
         [ -e "$MDIR$F" ] && [ ! -L "$MDIR$F" ] && {
            echo "$C: Kein SYMLINK: $MDIR$F"; continue
         }
         [ -e "$MDIR$F" ] && continue
         echo "$C: SYMLINK:"
      else
         [ -d "$F" ] && {
            [ -d "$MDIR$F" ] && continue
            [ -e "$MDIR$F" ] && {
               echo "$C: Kein DIR: $MDIR$F"; continue
            }
            mkdir -pv "$MDIR$F"; continue
         }
         [ -e "$MDIR$F" ] && [ ! "$F" -nt "$MDIR$F" ] && continue
      fi
      cp -Rpv "$F" "$MDIR$F"
   done
   ><
done

rm $TMP
[ M -eq 1 ] && umount -v "$MDIR" || { sleep 5; umount -v "$MDIR"; } || exit
echo ----------------------------------------------------------------
=======================================================================

-- 
Mit freundlichen Grüßen
Helmut Schellong   var@schellong.biz
www.schellong.de   www.schellong.com   www.schellong.biz
http://www.schellong.de/c.htm




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