[parted-devel] md blacklisting breaks Debian installer RAID support

Karel Zak kzak at redhat.com
Sat Jul 25 23:38:35 UTC 2009


On Fri, Jul 24, 2009 at 12:52:26PM +0100, Colin Watson wrote:
> From 936f5605af5b915b1a19d21c239a8b0c8d60e227 Mon Sep 17 00:00:00 2001
> From: Colin Watson <cjwatson at ubuntu.com>
> Date: Fri, 24 Jul 2009 12:43:42 +0100
> Subject: [PATCH] Recognise md devices again, but understand that they can't be partitioned
> 
> * libparted/arch/linux.c (_skip_entry): Don't skip "md" devices.
> (_has_partitions): New function; "loop" labels can't be partitioned.
> (_blkpg_add_partition, _blkpg_remove_partition, _dm_add_partition,
> _have_blkpg): Don't attempt to apply partition table changes to
> unpartitionable devices.
> ---
>  libparted/arch/linux.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
> index 5699197..f875581 100644
> --- a/libparted/arch/linux.c
> +++ b/libparted/arch/linux.c
> @@ -1985,7 +1985,6 @@ _skip_entry (const char *name)
>  		{ ".",		sizeof (".") - 1	},
>  		{ "..",		sizeof ("..") - 1	},
>  		{ "dm-",	sizeof ("dm-") - 1	},
> -		{ "md",		sizeof ("md") - 1	},
>  		{ "loop",	sizeof ("loop") - 1	},
>  		{ "ram",	sizeof ("ram") - 1	},
>  		{ 0, 0 },
> @@ -2180,6 +2179,18 @@ _partition_is_mounted (const PedPartition *part)
>  }
>  
>  static int
> +_has_partitions (const PedDisk* disk)
> +{
> +        PED_ASSERT(disk != NULL, return 0);
> +
> +        /* Some devices can't be partitioned. */
> +        if (!strcmp (disk->type->name, "loop"))
> +                return 0;
> +
> +        return 1;
> +}

 Incorrect.
 
 Linux kernel (since 2.6.26) supports partitioned /dev/loopN devices.
 (patch 476a4813cfddf7cf159956cc0e2d3c830c1507e3)

 I also think that device-mapper devices could be partitioned (and
 somewhere on the way to Linux upstream is a patch with BLKRRPART
 support for dm devices).

    Karel

-- 
 Karel Zak  <kzak at redhat.com>



More information about the parted-devel mailing list