From owner-freebsd-questions Mon Dec 16 10: 4:48 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06B1837B401 for ; Mon, 16 Dec 2002 10:04:47 -0800 (PST) Received: from the-frontier.org (ns1.the-frontier.org [216.86.199.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4647B43EC2 for ; Mon, 16 Dec 2002 10:04:46 -0800 (PST) (envelope-from pscott@skycoast.us) Received: from [192.168.66.249] (dhcp-249-66-168-192.the-frontier.org [192.168.66.249]) by the-frontier.org (8.9.3/8.9.3) with ESMTP id KAA25797; Mon, 16 Dec 2002 10:04:09 -0800 (PST) (envelope-from pscott@skycoast.us) User-Agent: Microsoft-Entourage/10.1.1.2418 Date: Mon, 16 Dec 2002 10:04:09 -0800 Subject: Re: [Fwd: Re: du -sh inconsistant with df -h] From: "Paul A. Scott" To: , "'Jens Rehsack'" , f-questions Message-ID: In-Reply-To: <001601c2a52a$58e88c80$c479f843@mike> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > From: Mike Loiterman >>>>> Where are the extra 1.6 megs at? >>>> >>>> If a running process opens a file and then unlink(2)'s it, the >>>> file will not >>>> show up in the filesystem, and du will not reflect any space it >>>> uses. However, df will. >>>> >>>> Paul >>> >>> >>> >>> So is there any way to reclaim that space aside from rebooting? >> >> Kill that process. >> > > How do I know which process is doing the right one? Prseumably, the > process itself has already been terminated, is this correct? You probably don't want (or need) to kill the process. It is probably working correctly. There are good reasons why a process will open a file and then immediately unlink it while it's still open. If the file is unlinked, then it can't be seen in the file system, so it's safer from prying eyes if it contains confidential data. Also, if the process terminates unexpectedly the file space is reclaimed automatically; no action required. When an open file is unlinked, the used space is not reclaimed (and may even grow larger if needed) until the file is closed or the process ends. This is a feature of unix systems. I don't know of any other OS that does this, but I've depended on this feature many times in the past when writing complex shell scripts that needed a large scratchpad for sensitive data. Read the man page on unlink(2) for an explanation. Paul -- Paul A. Scott mailto:pscott@skycoast.us http://skycoast.us/pscott/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message