From owner-freebsd-questions@FreeBSD.ORG Tue Apr 3 17:12:13 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6134016A402 for ; Tue, 3 Apr 2007 17:12:13 +0000 (UTC) (envelope-from xfb52@dial.pipex.com) Received: from smtp-out4.blueyonder.co.uk (smtp-out4.blueyonder.co.uk [195.188.213.7]) by mx1.freebsd.org (Postfix) with ESMTP id 0018C13C4B7 for ; Tue, 3 Apr 2007 17:12:12 +0000 (UTC) (envelope-from xfb52@dial.pipex.com) Received: from [172.23.170.144] (helo=anti-virus03-07) by smtp-out4.blueyonder.co.uk with smtp (Exim 4.52) id 1HYmYF-0003b4-Eo; Tue, 03 Apr 2007 18:12:11 +0100 Received: from [62.31.10.181] (helo=[192.168.0.2]) by asmtp-out1.blueyonder.co.uk with esmtp (Exim 4.52) id 1HYmYE-0001T7-CH; Tue, 03 Apr 2007 18:12:10 +0100 Message-ID: <46128AE9.8050807@dial.pipex.com> Date: Tue, 03 Apr 2007 18:12:09 +0100 From: Alex Zbyslaw User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-GB; rv:1.7.13) Gecko/20061205 X-Accept-Language: en MIME-Version: 1.0 To: Noah References: <46127E55.2040005@calarts.edu> <46128343.7050701@dial.pipex.com> <46128465.4040704@enabled.com> In-Reply-To: <46128465.4040704@enabled.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: var Filesystem Full Help 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: Tue, 03 Apr 2007 17:12:13 -0000 Noah wrote: > Alex Zbyslaw wrote: > >> Sean Murphy wrote: >> >>> I am getting these errors on my var filesystem but df -h shows there >>> is plenty of space available. >> >> >> Check df -i as you may have run out of inodes rather than out of file >> space. > > lsof is your friend First of all, please don't top-post. Second of all, I'm not the original poster so sending the email "To:" me isn't that helpful. Third of all, and most important, open files are irrelevant. The OP was using df. df counts free blocks in the file system. Files which are open and then deleted do not free their blocks and do not show up as free blocks in df. If the original command had been du, which traverses the file system to count usage and therefore can't count a file which has been deleted but is still open, then lsof might be useful. In this case it is not. A simple experiment to see this: 1) df /var Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad10s1e 5077038 116682 4554194 2% /var 2) Create a big file dd if=/dev/zero of=/var/tmp/HUGE bs=1m count=100 df /var Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad10s1e 5077038 219162 4451714 5% /var 3) Hold the file open; delete it; repeat df perl -e 'open(X, "/var/tmp/HUGE"); sleep 30;' & rm /var/tmp/HUGE remove /var/tmp/HUGE? y df /var Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad10s1e 5077038 219162 4451714 5% /var 4) Wait for open process to finish; repeat df [1] Done perl -e open(X, "/var/tmp/HUGE"); sleep 30; df /var Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad10s1e 5077038 116682 4554194 2% /var The available disk space start at 4554194, drops to 4451714 when the file is created, and *remains like that* until the process holding the file open exits, thus freeing the last reference and allowing the blocks to be freed. --Alex