Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2006 02:50:25 GMT
From:      Helmut Schellong <var@schellong.biz>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Message-ID:  <200605210250.k4L2oPQb010754@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/97513; it has been noted by GNATS.

From: Helmut Schellong <var@schellong.biz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Sun, 21 May 2006 04:46:00 +0200

 /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?200605210250.k4L2oPQb010754>