From owner-freebsd-questions@FreeBSD.ORG Tue Feb 3 21:53:33 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0A3B106566C for ; Tue, 3 Feb 2009 21:53:33 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 777888FC18 for ; Tue, 3 Feb 2009 21:53:33 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan-a.emsphone.com [199.67.51.107]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id n13LrWqD005323 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 3 Feb 2009 15:53:32 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n13LrSPi036519 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 3 Feb 2009 15:53:29 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n13LrRvO036518; Tue, 3 Feb 2009 15:53:27 -0600 (CST) (envelope-from dan) Date: Tue, 3 Feb 2009 15:53:27 -0600 From: Dan Nelson To: John Morgan Salomon Message-ID: <20090203215326.GN75802@dan.emsphone.com> References: <158E6ABD-6BCF-4222-AD59-9B43FE6832D5@zog.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 7.1-STABLE User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Tue, 03 Feb 2009 15:53:32 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-questions@freebsd.org Subject: Re: NFSv2 Wrong FS Size 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 Feb 2009 21:53:34 -0000 In the last episode (Feb 03), John Morgan Salomon said: > On 3 Feb 2009, at 19:21, John Morgan Salomon wrote: > > Hi there, > > > > I'm facing an odd problem with an NFSv2 mount. I'm using userland > > nfsd from a Buffalo TeraStation Pro v1 NAS, running PPC Linux 2.4.20. > > > > root@LEVIATHAN:~# uname -a > > Linux LEVIATHAN 2.4.20_mvl31-ppc_terastation #3 Tue Jul 18 09:29:11 JST 2006 ppc GNU/Linux > > > > I am sharing the following filesystem: > > > > root@LEVIATHAN:~# df -k > > Filesystem 1K-blocks Used Available Use% Mounted on > > > > /dev/md1 1755708928 979032844 776676084 56% /mnt/array1 > > > > Mounting this on a FreeBSD 7.1 client: > > > > behemoth# mount /data > > behemoth# df -k > > Filesystem 1024-blocks Used Avail > > Capacity Mounted on > > > > 192.168.2.11:/mnt/array1/data -391774720 -1168450804 776676084 > > I did more digging and found this: > > http://www.freebsd.org/projects/bigdisk/index.html > > "An audit is needed to make sure that all reported fields are 64-bit > clean. There are reports with certain fields being incorrect or > negative with NFS volumes, which could either be an NFS or df problem." > > Not sure where to go now, as the last entry in that project is dated > 2005 -- again, any tips welcome. The real problem is that NFSv2 only provides a 32-bit field for filesystem size, and multiplies that by the reported blocksize. Most NFS servers claim 512-byte blocks no matter what the underlying filessytem has, so in your case that would result in the filesystem size being reported as 1755708928*1024/512 = 3511417856 blocks. This number is larger than 2^31, which techinically isn't a problem because the NFSv2 spec says that the filesystem size is unsigned. FreeBSD treats it as signed, though, so it can display "negative" free space when root starts using its 8% reserve, so your unsigned 3511417856 gets printed as a signed -783549440, which messes everything up. NFSv3 uses 64-bit fields for those size values, so just mount with NFSv3 (which actually is the default on FreeBSD; maybe you have it disabled on your TeraStation for some reason), and you should get correct filesystem stats, as well as better performance and the ability to work with files over 2gb. Alternatively, you could rebuild "df" to print its numbers as unsigned instead of signed. Just watch out if your local filesystems start eating into their 8% reserve, since they'll start reporting huge values. -- Dan Nelson dnelson@allantgroup.com