From owner-freebsd-mobile@FreeBSD.ORG Mon Sep 20 16:50:25 2004 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F28716A511 for ; Mon, 20 Sep 2004 16:50:25 +0000 (GMT) Received: from tower.berklix.org (bsd.bsn.com [194.221.32.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 702EC43D1D for ; Mon, 20 Sep 2004 16:50:24 +0000 (GMT) (envelope-from jhs@flat.berklix.net) Received: from js.berklix.net (pD9E4DE09.dip.t-dialin.net [217.228.222.9]) (authenticated bits=0) by tower.berklix.org (8.12.9p2/8.12.9) with ESMTP id i8KGoHhB081653; Mon, 20 Sep 2004 18:50:18 +0200 (CEST) (envelope-from jhs@flat.berklix.net) Received: from laps.jhs.private (laps.jhs.private [192.168.91.56]) by js.berklix.net (8.12.11/8.12.11) with ESMTP id i8KGoJdl004175; Mon, 20 Sep 2004 18:50:20 +0200 (CEST) (envelope-from jhs@flat.berklix.net) Received: from laps.jhs.private (localhost [127.0.0.1]) by laps.jhs.private (8.13.1/8.13.1) with ESMTP id i8KGoJYa002732; Mon, 20 Sep 2004 18:50:19 +0200 (CEST) (envelope-from jhs@laps.jhs.private) Received: (from jhs@localhost) by laps.jhs.private (8.13.1/8.13.1/Submit) id i8KGoGLF002731; Mon, 20 Sep 2004 18:50:16 +0200 (CEST) (envelope-from jhs) Date: Mon, 20 Sep 2004 18:50:16 +0200 (CEST) From: User Jhs Message-Id: <200409201650.i8KGoGLF002731@laps.jhs.private> To: freebsd-mobile@freebsd.org Fcc: sent-mail sent-mail In-Reply-To: Message from "Julian Stacey" <200409141058.i8EAwbSm001391@laps.jhs.private> cc: Christopher Sean Hilton Subject: Re: How to get usbd to umount fle systems without crashing ? X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2004 16:50:25 -0000 Re. my question on mount & dismount of memory sticks: Thanks to all (Hank, Brooks, Chris, (hope I missed no one)), ( Chris's examples were particularly useful in Message-id: <20040914155115.GB13849@dantooine.vindaloo.com> ) > You want to use the automounter for this. The reason it's dying is > because FreeBSD is trying to write information (dirty buffers) back to > the filesystem after the device has disappeared. The correct sequence > for this would be umount the filesystem, then unplug the device. Yes. After I posted, I added to the options list in /etc/fstab ",sync" & checked with tunefs -p that soft updates were disabled on the USB memory stick (they already were). It didnt help. I'm not suprised FreeBSD crashes when a write mounted partition is removed, but it's sad something mounted read only crashes. Read mounted fd0: floppies dont crash immediately when removed (fortunately no usbd killing devs there). > I'm not sure if the portmapper is relevent. I recall AMD or NFS wants it. On my other FreeBSD-4 hosts using NFS, portmapper is not neeeded in my rc.conf, as it gets started automaticaly. In a stand alone laptop with no net, not running NFS one would still want AMD, so I've set rpcbind_enable="YES" in case. I have 2 problems still, (with 2 configs as below): - The 2nd mount in attach line fails (see comment in usbd.conf below). Maybe some USB kernel problem that might go away when I upgrade from { 5.2-CURRENT built from src/ day or 2 before Sep 3. } to 5.2-stable or 5.3-Rel. ? - AMD fails to unmount USB devices, (but does unmount cdrom OK eg this works: cd /host/cdrom;ls;cd /; sleep 20;mount |grep cdrom ) Comments requested. 1st Config: of /etc/ usbd.conf fstab amd.map rc.conf { usbd.conf: { device "jhs Memory stick Celldisk Pro. IOCELL - M-Systems" vendor 0x08ec product 0x0834 release 0x0100 attach "sleep 2 ; mount -r /dev.dummy/usb.0 ; mkdir /.amd_mnt/usb.ufs.0 ; mount /.amd_mnt/usb.ufs.0; mkdir /.amd_mnt/usb.dos.0 ; mount /.amd_mnt/usb.dos.0" # Sleep: proven necessary. # Mkdir: if already run at previous insertions (inc. boot with memory # stick in place) will fail subsequently as already exists # (unless amd removes unused directories) so mkdirs are # seperated in case it aborts on first pre-existing when 2nd # still needed. # Mount: 2nd always fails, regardless which is 1st & 2nd. # typical error message even if done manually after: # msdosfs: /dev/da0s1: Operation not permitted. # Umount: should be done by amd, not by detach, as it crashes system. # (after detach of usb stick there is no device to umount). # detach "umount /stick.bsd; umount /stick.dos" # devname "umass0" } fstab: { /dev/da0 /dev.dummy/usb.0 msdos ro,noauto 0 0 # da[01] to enable a probe to initiate automatic creation of da[[01]s[1-4]. /dev/da0s1 /.amd_mnt/usb.dos.0 msdos rw,noauto 0 0 /dev/da0s2a /.amd_mnt/usb.ufs.0 ufs rw,noatime,noauto 0 0 } amd.map: { /defaults type:=host;fs:=${autodir}/${rhost};rhost:=${key} laps type:=link;fs:=.. * opts:=rw,grpid,resvport,vers=2,proto=udp,nodev cdrom type:=cdfs;fs:=${autodir}/${key};dev:=/dev/acd0;addopts:=ro,rrip /.amd_mnt/usb.dos.0 type:=program;fs:=${autodir}/${key};\ mount:="/sbin/mount mount ${fs}";unmount:="/sbin/umount umount ${fs}" /.amd_mnt/usb.ufs.0 type:=program;fs:=${autodir}/${key};\ mount:="/sbin/mount mount ${fs}";unmount:="/sbin/umount umount ${fs}" } rc.conf: { rpcbind_enable="YES" # No by default, Replaces portmap_enable. usbd_enable="YES" amd_enable="YES" amd_flags="-c 30 -l syslog -n -r -t 3 -w 12 /host /etc/amd.map" # "-c 30" reduce name caching from default 300 sec. # "-n" map /host/user to /.amd_mnt/flip # "-r" inherit existing mounts (eg from USB insertion) # "-t3" used to be a bit slow see amd.map # "-w 12" dismount default is 120 seconds # Frequent scans for unmount for memory stick to avoid crash. # chris@vindaloo.c__ uses "-c 30" but not "-w 12". } } 2nd Config: of /etc/ usbd.conf fstab amd.map rc.conf { As above, except to try to debug the amd umount failure: { usbd.conf: { attach "sleep 2 ; mount -r /dev.dummy/usb.0 ; mkdir /usb.ufs.0 ; mount /usb.ufs.0; mkdir /usb.dos.0 ; mount /usb.dos.0" } fstab: { /dev/da0s1 /usb.dos.0 msdos rw,noauto 0 0 /dev/da0s2a /usb.ufs.0 ufs rw,noatime,noauto 0 0 } amd.map: { usb.dos.0 type:=msdos;fs:=${autodir}/${key};dev:=/dev/da0s1;addopts:=sync usb.ufs.0 type:=ufs;fs:=${autodir}/${key};dev:=/dev/da0s2a;addopts:=sync } } - Julian Stacey. Unix,C,Net & Sys. Eng. Consultant, Munich. http://berklix.com Mail in Ascii, Html dumped as Spam. Ihr Rauch = mein allergischer Kopfschmerz.