From owner-freebsd-current@FreeBSD.ORG Fri Jun 6 10:38:38 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B007137B401 for ; Fri, 6 Jun 2003 10:38:38 -0700 (PDT) Received: from abel.math.ntnu.no (abel.math.ntnu.no [129.241.15.50]) by mx1.FreeBSD.org (Postfix) with SMTP id 5DB2943F75 for ; Fri, 6 Jun 2003 10:38:37 -0700 (PDT) (envelope-from perhov@math.ntnu.no) Received: (qmail 5789 invoked by uid 29119); 6 Jun 2003 17:38:36 -0000 Date: Fri, 6 Jun 2003 19:38:36 +0200 (MEST) From: Per Kristian Hove To: freebsd-current@freebsd.org In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: geom_vol_ffs problems X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2003 17:38:39 -0000 I've nailed it down to this: geom_vol_ffs assumes that a file system is able to fill the partition completely. That's not a valid assumption, since the file system size is a multiple of the file system block size (in my case 16k bytes = 32 blocks), and the partition size is/should be a multiple of the sectors/cylinder count (in my case 1008). For this assumption to be valid, the sectors/cylinder count would have to be a multiple of the file system block size (measured in blocks), and there's no guarantee that that's the case. In my case, the size of the filesystem on ad0s3f (the one that does not appear in /dev/vol/) is one block less than the size of ad0s3f itself, so geom_vol_ffs refuses to create a provider for it (lines 96 and 102 in geom_vol_ffs.c): if (fs->fs_old_size * fs->fs_fsize != (int32_t) pp->mediasize) { g_free(fs); continue; } Part of the problem here is my disklabel - it's hand-made, and the size of the "f" partition (where geom_vol_ffs fails) is an odd number - 3054277 - so that's impossible for the file system to fill it completely. I should create my disklabels so that the size of each partition is a multiple of the number of sectors per cylinder. However, this is not sufficient for geom_vol_ffs to do what it's supposed to, for the reason explained above. I think geom_vol_ffs.c at least should test for this instead: if ((fs->fs_old_size * fs->fs_fsize > (int32_t) pp->mediasize) || ((int32_t) pp->mediasize - fs->fs_old_size * fs->fs_fsize >= fs->fs_bsize)) { g_free(fs); continue; } The (fs->fs_old_size * fs->fs_fsize > (int32_t) pp->mediasize) test is probably not sufficient by itself, unless GEOM is modified to ignore "c" partitions, that usually start with a valid UFS magic (unless the partition with offset 0 is a swap partition, of course). I would prefer telling GEOM to ignore "c" partitions, and test for this: if (fs->fs_old_size * fs->fs_fsize > (int32_t) pp->mediasize) { g_free(fs); continue; } as that would make geom_vol_ffs continue to work even if you dd(1) an existing file system from a small to a larger partition/disk, but that may have other implications I'm not aware of? -- Per Kristian Hove Dept. of Mathematical Sciences Norwegian University of Science and Technology