maximilian attems
2006-Apr-18 09:32 UTC
[klibc] [patch] fstype fix ext3 <-> lvm2 detection
From: David H?rdeman <david@2gen.com> if a partition has been used as lvm2 and has not been cleared with pvremove, fstype would recognise the ext3 partition as lvm2. workaround that by detection lvm2 after ext3. Bonuspoint remove long fs list as this one just generates conflicts. Signed-off-by: David H?rdeman <david@2gen.com> Signed-off-by: maximilian attems <maks@sternwelten.at> diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c index c892c6b..17a89ce 100644 --- a/usr/kinit/fstype/fstype.c +++ b/usr/kinit/fstype/fstype.c @@ -6,8 +6,8 @@ * FSTYPE - filesystem type * FSSIZE - filesystem size (if known) * - * We currently detect (in order): - * gzip, cramfs, romfs, xfs, luks, lvm2, minix, ext3, ext2, reiserfs, jfs, swap + * We currently detect the filesystems listed below in the struct + * "imagetype images" (in the order they are listed). * * MINIX, ext3 and Reiserfs bits are currently untested. */ @@ -231,8 +231,13 @@ struct imagetype { /* * Note: + * * Minix test needs to come after ext3/ext2, since it's possible for * ext3/ext2 to look like minix by pure random chance. + * + * LVM comes after all other filesystems since it's possible + * that an old lvm signature is left on the disk if pvremove + * is not used before creating the new fs. */ static struct imagetype images[] = { { 0, "gzip", gzip_image }, @@ -240,14 +245,14 @@ static struct imagetype images[] = { { 0, "romfs", romfs_image }, { 0, "xfs", xfs_image }, { 0, "luks", luks_image }, - { 0, "lvm2", lvm2_image }, - { 1, "lvm2", lvm2_image }, { 1, "ext3", ext3_image }, { 1, "ext2", ext2_image }, { 1, "minix", minix_image }, { 8, "reiserfs", reiserfs_image }, { 64, "reiserfs", reiserfs_image }, { 32, "jfs", jfs_image }, + { 0, "lvm2", lvm2_image }, + { 1, "lvm2", lvm2_image }, { -1, "swap", swap_image }, { 0, "", NULL } };