From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Tso Subject: Re: Upgrading datastructures between different filesystem versions Date: Fri, 28 Sep 2007 15:47:24 -0400 Message-ID: <20070928194723.GI8688@thunk.org> References: <7e77a4050709250827p26683c6bqc65832783ba1c365@mail.gmail.com> <46F9F0EB.6020404@gmail.com> <20070926161756.GU32520@schatzie.adilger.int> <20070928131100.GA2904@gateway.home> <20070928133146.GA9139@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Erik Mouw , Sachin Gaikwad , Jim Cromie , kernel learner , linux-fsdevel@vger.kernel.org, kernelnewbies@nl.linux.org To: Christoph Hellwig Return-path: Received: from THUNK.ORG ([69.25.196.29]:48375 "EHLO thunker.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752238AbXI1Trc (ORCPT ); Fri, 28 Sep 2007 15:47:32 -0400 Content-Disposition: inline In-Reply-To: <20070928133146.GA9139@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Sep 28, 2007 at 02:31:46PM +0100, Christoph Hellwig wrote: > On Fri, Sep 28, 2007 at 03:11:00PM +0200, Erik Mouw wrote: > > There are however ways to confuse it: if you reformat an ext3 > > filesystem to reiserfs (version 3), mounting that filesystem without > > "-t reiserfs" will trick mount(8) into mounting it as an ext3 > > filesystem (which will usually fail). This is because the ext3 > > superblocks lives at offset 0x400, and the reiserfs superblock at > > 0x8000. When you format a partition as reiserfs, it will not erase old > > ext3 superblocks. Before looking for a reiserfs superblock, mount(8) > > first looks for an ext3 superblock. The old ext3 superblock wasn't > > erased, but usually most of the other ext3 structures are and so > > mount(8) will fail to mount the filesystem. Don't know if this > > particular "bug" is still there, but it has bitten me in the past. > > This is easy to fix, though. Quoting mkfs.xfs: > > /* > * Zero out the beginning of the device, to obliterate any old > * filesystem signatures out there. This should take care of > * swap (somewhere around the page size), jfs (32k), > * ext[2,3] and reiserfs (64k) - and hopefully all else. > */ > buf = libxfs_getbuf(xi.ddev, 0, BTOBB(WHACK_SIZE)); > bzero(XFS_BUF_PTR(buf), WHACK_SIZE); > libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); > libxfs_purgebuf(buf); Ext3 does something similar, zapping space at the beginning AND the end of the partition (because the MD superblocks are at the end). It's just a misfeature of reiserfs's mkfs that it doesn't do this. - Ted