Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 1998 12:52:23 -0400 (EDT)
From:      CyberPeasant <djv@bedford.net>
To:        bryan@chesco.com (Bryan Seltzer)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: var:device busy?
Message-ID:  <199806171652.MAA25971@lucy.bedford.net>
In-Reply-To: <199806171030.GAA28474@carriage.chesco.com> from Bryan Seltzer at "Jun 7, 98 07:40:13 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Bryan Seltzer wrote:
> vers 2.2.6
> 
> I need help, this is what I am doing
> 
> mkdir /usr/var
> cd /var  (old var dir)
> tar -cf - . | (cd /usr/var; tar xf - )
> cd /
> rm -rf /var after this command I get this response
> 
> /var:
> device busy
> 
> can anyone tell me why?

Sure. Because it's busy :)  (i.e. the error message is not in error).

When you rm a file, the file doesn't really go away until all processes
that have the file open close it. In your case, it's a safe bet that
syslogd and maybe a bunch of other daemons have open files on /var.

Try this:
	logger "Test log message"

Betcha it doesn't show up in /usr/var/log/messages. But the drive light
blinked ;)  If you had started a tail -f /var/log/messages before
doing the rm -rf /var, it /would/ have shown up in that window.

A lot of programs do this with tempfiles... open them on /tmp,
then unlink(2) them. It removes them from the file system (the name
is gone -- not hidden -- /gone/). Then no matter how the process ends,
the space is returned. (Well, a system crash might not free it).

In your case, go to single user mode (kill -TERM 1), then see if
you can get rid of old /var, and make a new one; doubtless your
intention is for it to be a symlink to /usr/var.

If for some reason this trip to single user can't be accomplished,
rename /var to something else, make the new symlink, then manually
HUP the daemons. Syslogd is a sure bet. 

Just rebooting won't do it. -- you'll have to rename /var or rmdir
it somehow. Single user mode is the "clean, righteous and ancient"
method. Acutally, any fiddling with "touchy" directories should be
done in sing. user mode.

Dave
-- 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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