Re: geom_vol_ffs problems

From: Per Kristian Hove <Per.Hove_at_math.ntnu.no>
Date: Fri, 6 Jun 2003 19:38:36 +0200 (MEST)
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
Received on Fri Jun 06 2003 - 08:38:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:10 UTC