From owner-freebsd-questions Wed Jun 17 10:24:50 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA26990 for freebsd-questions-outgoing; Wed, 17 Jun 1998 10:24:50 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from lucy.bedford.net (lucy.bedford.net [206.99.145.54]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA26979 for ; Wed, 17 Jun 1998 10:24:46 -0700 (PDT) (envelope-from listread@lucy.bedford.net) Received: (from listread@localhost) by lucy.bedford.net (8.8.8/8.8.8) id MAA25971; Wed, 17 Jun 1998 12:52:23 -0400 (EDT) (envelope-from listread) Message-Id: <199806171652.MAA25971@lucy.bedford.net> Subject: Re: var:device busy? In-Reply-To: <199806171030.GAA28474@carriage.chesco.com> from Bryan Seltzer at "Jun 7, 98 07:40:13 pm" To: bryan@chesco.com (Bryan Seltzer) Date: Wed, 17 Jun 1998 12:52:23 -0400 (EDT) Cc: freebsd-questions@FreeBSD.ORG X-no-archive: yes Reply-to: djv@bedford.net From: CyberPeasant X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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