From owner-freebsd-stable@FreeBSD.ORG Wed Jun 14 20:30:54 2006 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AFEED16A47B for ; Wed, 14 Jun 2006 20:30:54 +0000 (UTC) (envelope-from chris@vindaloo.com) Received: from corellia.vindaloo.com (corellia.vindaloo.com [64.51.148.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E13043D5F for ; Wed, 14 Jun 2006 20:30:32 +0000 (GMT) (envelope-from chris@vindaloo.com) Received: from yavin.vindaloo.com (yavin.vindaloo.com [172.24.144.34]) by corellia.vindaloo.com (Postfix) with ESMTP id AA47E5CA1; Wed, 14 Jun 2006 16:29:30 -0400 (EDT) Received: from dagobah.vindaloo.com (dagobah.vindaloo.com [172.24.145.68]) by yavin.vindaloo.com (Postfix) with ESMTP id 4B77B25333; Wed, 14 Jun 2006 16:30:31 -0400 (EDT) Received: from dagobah.vindaloo.com (localhost [127.0.0.1]) by dagobah.vindaloo.com (8.13.6/8.13.6) with ESMTP id k5EKKNkL002534; Wed, 14 Jun 2006 16:20:23 -0400 (EDT) (envelope-from chris@dagobah.vindaloo.com) Received: (from chris@localhost) by dagobah.vindaloo.com (8.13.6/8.13.6/Submit) id k5EKKNUG002533; Wed, 14 Jun 2006 16:20:23 -0400 (EDT) (envelope-from chris) Resent-Message-Id: <200606142020.k5EKKNUG002533@dagobah.vindaloo.com> X-Original-To: chris@vindaloo.com Delivered-To: chris@vindaloo.com Received: from dagobah.vindaloo.com (dagobah.vindaloo.com [172.24.145.68]) by yavin.vindaloo.com (Postfix) with ESMTP id 15A272544E; Wed, 14 Jun 2006 16:16:58 -0400 (EDT) Received: from dagobah.vindaloo.com (localhost [127.0.0.1]) by dagobah.vindaloo.com (8.13.6/8.13.6) with ESMTP id k5EKG0RT002512; Wed, 14 Jun 2006 16:16:00 -0400 (EDT) (envelope-from chris@dagobah.vindaloo.com) Received: (from chris@localhost) by dagobah.vindaloo.com (8.13.6/8.13.6/Submit) id k5EKFvVb002511; Wed, 14 Jun 2006 16:15:57 -0400 (EDT) (envelope-from chris) Date: Wed, 14 Jun 2006 16:15:57 -0400 From: Christopher Sean Hilton To: Zaphod Beeblebrox Message-ID: <20060614201557.GC1537@dagobah.vindaloo.com> References: <448B0419.3090303@cs.tu-berlin.de> <20060612193427.GE1226@roadrunner.aventurien.local> <5f67a8c40606121344g18d53ce9x4038384a734c3ce0@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5f67a8c40606121344g18d53ce9x4038384a734c3ce0@mail.gmail.com> User-Agent: Mutt/1.4.2.1i X-Spam-Checker-Version: SpamAssassin 2.63-csh_yavin_1.0.3 (2004-01-11) on yavin.vindaloo.com X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=4.5 tests=BAYES_00 autolearn=ham version=2.63-csh_yavin_1.0.3 X-filtered: yavin.vindaloo.com Resent-From: Christopher Sean Hilton Resent-Date: Wed, 14 Jun 2006 16:20:22 -0400 Resent-To: bkoenig@cs.tu-berlin.de, stable@freebsd.org Cc: freebsd-questions@freebsd.org Subject: Re: unmounting a filesystem safely that doesn't exist anymore X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2006 20:30:54 -0000 On Mon, Jun 12, 2006 at 04:44:48PM -0400, Zaphod Beeblebrox wrote: > On 6/12/06, Ulrich Spoerlein wrote: > > > >Björn König wrote: > > > > > >> I did a mistake: I unplugged my digital camera accidentally before I > >unmounted the > >> filesystem. *doh* This happens very often, because I'm very > >scatterbrained. =) The kernel > >> will panic and all filesystems remain unclean in any case now. I know > >that this is a well > >> know issue and in past discussions you stated that this behaviour is > >intended and won't be > >> changed ad hoc. I just want to know if somebody knows a workaround or > >small trick that > >> prevents the other filesystems from being unclean on next boot-up. > > > >You might give the automounter (am-utils) a whirl. They are very > >confusing to set up, but you can set the unmount-if-unused timeout to > >something like 5 seconds. This could narrow the window enough to not > >panic you system frequently :) > > > That's rather hackish ... especially since this is a common problem and a > rather obvious hole in using FreeBSD for noobs. > I've been using the automounter to handle these mounts for about three years now. When I started I would be have to run fsck on my memory stick about twice a day. Now it's more like once a month. In short it works. I've got to admit that I agree with the fact that this is a more than rather hackish solution to the problem. The real issue here is that for Unix, filesystems come in two types: Those on hard disks which are perpetually available once they've been mounted once, and those which come from the network which can come and go as they please. The automounter works as a solution to this problem by making a local filesystem on hotplugable hardware look like it's coming from a network. It took me the better part of a day to figure out how to make the automounter work properly in this situation. In my case I was using a UFS formatted memory stick which complicated things. The automounter was coded with the assumption that UFS filesystems only exist on drives that are bolted into the computer. The automounter will gladly mount a UFS volume but because it's a UFS volume it never feels the need to dismount the volume and leave it in a clean state. Another problem is that most tools today makes a similar the assumption about mounted volumes that they didn't graft into the filesystem. So, for example opening up the Nautilus file browser on /amd/ufs0 on my system creates an entry in some magic file somewhere that tells Nautilus to periodically visit that directory. As far as amd is concerned these visits are valid requests to mount the filesystem. The end result is that the filesystem again remains permanently mounted. With MS-DOS FAT filesystems the problem is who mounted the filesystem. Amd mounts my MP3 player read-write on /amd/mp3 perms 777 root:wheel. I use rsync to copy podcasts from a holding directory on my desktop to it. And rsync complains all the time that it can copy the files but it cannot change the date/time. This is because chris:chris cannot change an entry in a directory owned by root:wheel, as it should be. It doesn't sound like I'm trying to sell this but in the long run I actually believe that amd is the best of a bunch of mediocre solutions. I wish however that: Amd didn't make the assumption that a UFS volume was going to be there forever; Gnome could be told that filesystems under /amd or some other programmable mount point will come and go with the wind so don't cache the names; That more applications would understand that there are people using the automounter and that a mount request can be accomplished by a simple: $ ls -l /amd/foo and a umount request can be accomplished by a doing: $ amq -u /amd/foo Look for a followup with configs.g -- Chris -- Chris Hilton chris-at-vindaloo-dot-com ------------------------------------------------------------------------ "All I was doing was trying to get home from work!" -- Rosa Parks