Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Feb 2009 00:08:58 -0700
From:      Tim Judd <tajudd@gmail.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Determining process preventing umount of busy partition
Message-ID:  <4993CB0A.7090809@gmail.com>
In-Reply-To: <20090212062505.ca66b93e.freebsd@edvax.de>
References:  <20090212062505.ca66b93e.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4993CB0A.7090809>