From owner-freebsd-questions@FreeBSD.ORG Thu Feb 12 07:09:36 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6B7B106564A for ; Thu, 12 Feb 2009 07:09:36 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174]) by mx1.freebsd.org (Postfix) with ESMTP id A596F8FC18 for ; Thu, 12 Feb 2009 07:09:36 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: by wf-out-1314.google.com with SMTP id 27so529274wfd.7 for ; Wed, 11 Feb 2009 23:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=/XtbGxlNE1tg7UpGy/Fo9onpoGIbFzfeZCYrDHvVXyk=; b=RyyXdWCxvqlXCdkw1ZQM/VFM96WjdQXPNRRy9z02lnBFDbE6deuI6x/kHb97ScAw4I pqO7h/6z2ghLw9x7gEjN73iL5ByxGY4ktuE3amZcczp9EnceHGL/6iWoksiPiTQ7Q4WT Pf6vHm/Ygz0QD4jaVqqRphDiLQI1vT+JGb5fs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=IBeZ9dH9cQLDYEgfG7b1inr8jBwOJs5dip4bu4MT0PqvGGfpbN3gYi62+FfN8hthhb 0D+XB4HX4BVszjHWuPsf6nuNYYXhINlPdLOjK/TkTyETWSD3l3N8vT5HAcIeFRrpY4hx kCQgauh6RUyIrYRHuLwdYajYfayaIC4zvcZ8Y= Received: by 10.142.226.3 with SMTP id y3mr301300wfg.325.1234422576386; Wed, 11 Feb 2009 23:09:36 -0800 (PST) Received: from ?192.168.4.44? (c-68-35-57-46.hsd1.nm.comcast.net [68.35.57.46]) by mx.google.com with ESMTPS id 27sm19604911wfa.30.2009.02.11.23.09.35 (version=SSLv3 cipher=RC4-MD5); Wed, 11 Feb 2009 23:09:35 -0800 (PST) Message-ID: <4993CB0A.7090809@gmail.com> Date: Thu, 12 Feb 2009 00:08:58 -0700 From: Tim Judd User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Polytropon References: <20090212062505.ca66b93e.freebsd@edvax.de> In-Reply-To: <20090212062505.ca66b93e.freebsd@edvax.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: Determining process preventing umount of busy partition X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2009 07:09:37 -0000 Polytropon wrote: > I'd like to ask how to determine which process (or program) keeps a partition > in state "busy" so that umount will refuse to unmount this partition. I found > this when going into SUM for checking and maintenance, so I think it would be > good to check which program still accesses files on a specific partition > allthough it should already be terminated due to the different "stop" mechanisms > run for the services in /etc/rc.d and /usr/local/etc/rc.d respectively, which > is performed by init, if I understood this correctly. > > Example: > > % shutdown now > > ... going SUM, starting sh ... > > # umount /home > # umount /tmp > # umount /var > # umount /usr > umount: unmount of /usr failed: Device busy > # umount -f /usr > # mount -o ro / > # fsck ... blah blah ... > > It would be good to be able to check why the partition is in state "busy" and > possible terminate / kill processes that cause this. Using the force (-f) seems > to be unneccessarily unfriendly. =^_^= > > Thanks for suggestions! Most commonly for me is because my $PWD (or CWD) is in the filesystem i intend to umount so as a habit now, i move myself to the root partition (when logged in as root) via the following, and assuming I want to umount /usr # umount /usr umount: unmount of /usr failed: Device busy # cd # umount /usr cd, with no arguments, move you to ~ (aka $HOME) --Tim