From owner-freebsd-bugs@FreeBSD.ORG Wed Jan 24 21:10:20 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4B85C16A406 for ; Wed, 24 Jan 2007 21:10:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 6FAF613C45D for ; Wed, 24 Jan 2007 21:10:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l0OLAJmw000630 for ; Wed, 24 Jan 2007 21:10:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l0OLAJuu000629; Wed, 24 Jan 2007 21:10:19 GMT (envelope-from gnats) Resent-Date: Wed, 24 Jan 2007 21:10:19 GMT Resent-Message-Id: <200701242110.l0OLAJuu000629@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Toby Burress Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B305016A401 for ; Wed, 24 Jan 2007 21:09:03 +0000 (UTC) (envelope-from kurin@delete.org) Received: from cobalt.delete.org (cobalt.delete.org [198.177.254.162]) by mx1.freebsd.org (Postfix) with ESMTP id 91C5B13C43E for ; Wed, 24 Jan 2007 21:09:03 +0000 (UTC) (envelope-from kurin@delete.org) Received: from localhost (localhost.delete.org [127.0.0.1]) by cobalt.delete.org (Postfix) with ESMTP id 4252E84429 for ; Wed, 24 Jan 2007 15:38:09 -0500 (EST) Received: from cobalt.delete.org ([127.0.0.1]) by localhost (cobalt.delete.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dMZq-V1n--1u for ; Wed, 24 Jan 2007 15:37:39 -0500 (EST) Received: by cobalt.delete.org (Postfix, from userid 1028) id C87DD8446A; Wed, 24 Jan 2007 15:37:39 -0500 (EST) Message-Id: <20070124203739.C87DD8446A@cobalt.delete.org> Date: Wed, 24 Jan 2007 15:37:39 -0500 (EST) From: Toby Burress To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/108320: dumpfs(8) lists wrong file system size [PATCH?] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Toby Burress List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2007 21:10:20 -0000 >Number: 108320 >Category: bin >Synopsis: dumpfs(8) lists wrong file system size [PATCH?] >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 24 21:10:18 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Toby Burress >Release: FreeBSD 6.1-RELEASE amd64 >Organization: >Environment: /usr/src/sbin/dumpfs >Description: When using dumpfs(8) to check the file system size, and in particular dumpfs -m to find a command that creates the file system, the size listed is smaller than the actual size of the file system. >How-To-Repeat: Run the following shell script (without warranty, etc etc, it doesn't do anything bad but don't blame me if your power supply explodes) and note the df lines. #!/bin/sh touch testfile FS=`mdconfig -a -t vnode -f testfile -s 200M` fdisk -I /dev/${FS} bsdlabel -w /dev/${FS}s1 newfs /dev/${FS}s1a dumpfs -m /dev/${FS}s1a > newfsfile mount /dev/${FS}s1a /mnt df -h /mnt umount /dev/${FS}s1a sh newfsfile mount /dev/${FS}s1a /mnt df -h /mnt umount /dev/${FS}s1a mdconfig -d -u ${FS} rm testfile newfsfile >Fix: In my case the reported file system size is 4 times too small. This just happens to be the size of the "ncg" parameter. So I think a fix might be: --- dumpfs.c.old Fri Apr 9 15:58:27 2004 +++ dumpfs.c Wed Jan 24 14:57:19 2007 @@ -135,7 +135,7 @@ printf("superblock location\t%jd\tid\t[ %x %x ]\n", (intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]); printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n", - afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize); + afs.fs_ncg, (intmax_t)fssize * afs.fs_ncg, (intmax_t)afs.fs_dsize); break; case 1: fssize = afs.fs_old_size; @@ -144,7 +144,7 @@ afs.fs_magic, ctime(&fstime)); printf("id\t[ %x %x ]\n", afs.fs_id[0], afs.fs_id[1]); printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n", - afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize); + afs.fs_ncg, (intmax_t)fssize * afs.fs_ncg, (intmax_t)afs.fs_dsize); break; default: goto err; @@ -367,7 +367,7 @@ break; } /* -p..r unimplemented */ - printf("-s %jd ", (intmax_t)fs->fs_size); + printf("-s %jd ", (intmax_t)fs->fs_size * fs->fs_ncg); printf("%s ", disk.d_name); printf("\n"); Of course, long experience has taught me that I never know what I'm talking about, so even though this gives the right answers, maybe the fix is somewhere else? Either way, dumpfs is wrong and needs to be fixed. >Release-Note: >Audit-Trail: >Unformatted: