From owner-freebsd-current@FreeBSD.ORG  Wed Nov  3 07:15:46 2010
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6AC061065670
	for <freebsd-current@freebsd.org>; Wed,  3 Nov 2010 07:15:46 +0000 (UTC)
	(envelope-from pho@holm.cc)
Received: from relay00.pair.com (relay00.pair.com [209.68.5.9])
	by mx1.freebsd.org (Postfix) with SMTP id 1B4648FC17
	for <freebsd-current@freebsd.org>; Wed,  3 Nov 2010 07:15:46 +0000 (UTC)
Received: (qmail 82243 invoked from network); 3 Nov 2010 06:49:05 -0000
Received: from 93.166.52.54 (HELO x2.osted.lan) (93.166.52.54)
	by relay00.pair.com with SMTP; 3 Nov 2010 06:49:05 -0000
X-pair-Authenticated: 93.166.52.54
Received: from x2.osted.lan (localhost [127.0.0.1])
	by x2.osted.lan (8.14.3/8.14.3) with ESMTP id oA36n5Xg039844;
	Wed, 3 Nov 2010 07:49:05 +0100 (CET) (envelope-from pho@x2.osted.lan)
Received: (from pho@localhost)
	by x2.osted.lan (8.14.3/8.14.3/Submit) id oA36n5SE039843;
	Wed, 3 Nov 2010 07:49:05 +0100 (CET) (envelope-from pho)
Date: Wed, 3 Nov 2010 07:49:04 +0100
From: Peter Holm <pho@freebsd.org>
To: Bruce Cran <bruce@cran.org.uk>
Message-ID: <20101103064904.GA39407@x2.osted.lan>
References: <201011021912.14281.bruce@cran.org.uk>
	<201011021933.51052.bruce@cran.org.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201011021933.51052.bruce@cran.org.uk>
User-Agent: Mutt/1.4.2.3i
Cc: freebsd-current@freebsd.org
Subject: Re: Corruption of UFS filesystems after using md(4)
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Nov 2010 07:15:46 -0000

On Tue, Nov 02, 2010 at 07:33:50PM +0000, Bruce Cran wrote:
> On Tuesday 02 November 2010 19:12:14 Bruce Cran wrote:
> > I've noticed in recent months that I appear to be getting silent corruption
> > of my UFS filesystems - and I think it may be linked to using md(4) or
> > creating sparse files.
> 
> I've confirmed this is a UFS bug related to sparse files: "truncate -s20G f1 
> && rm f1" is enough to trigger the error and start generating .viminfo files 
> that appear to be 20GB. When running fsck I get an "Invalid block count" error 
> if I just reboot without removing the .viminfo file; if I do remove it, I get 
> a "Partially allocated inode" error.
> 

I'm able to verify this by:

"m.sh" 49L, 1917C written
$ ./m.sh
Local config: x4
+ mdconfig -a -t swap -s 1g -u 5
+ bsdlabel -w md5 auto
+ newfs -U md5a
+ mount /dev/md5a /mnt
+ truncate -s20G /mnt/f1
+ rm /mnt/f1
+ umount /mnt
+ fsck -t ufs -y /dev/md5a
** /dev/md5a
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
PARTIALLY ALLOCATED INODE I=4
UNEXPECTED SOFT UPDATE INCONSISTENCY

CLEAR? yes

** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

2 files, 2 used, 506481 free (25 frags, 63307 blocks, 0.0%
fragmentation)

***** FILE SYSTEM IS CLEAN *****

***** FILE SYSTEM WAS MODIFIED *****
+ mdconfig -d -u 5
$ 

- Peter