I've also filed this as a debian bugreport,
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684713

Linux md raid array devices come in two flavours: partionable
(/dev/md_d0) and non-partitionable (/dev/md0). Or at least,
that used to be the case, until kernel 2.6.28 where the two have
been consolidated. Now all md devices can have partitions.

However, there is one minor oversight/bug in the kernel: the
sysfs "range" key is still set to "1" for md devices. That means
libparted thinks that it's not possible to partition that device,
when in fact it is.

The attached patch reckognizes that situation: if running on
a kernel >= 2.6.28, and the device is a PED_DEVICE_MD, and the
sysfs 'range' key is set to '1', _device_get_partition_range()
returns MAX_NUM_PARTS instead.

Mike.
Index: parted-2.3/libparted/arch/linux.c
===================================================================
--- parted-2.3.orig/libparted/arch/linux.c	2010-05-10 10:57:54.000000000 +0000
+++ parted-2.3/libparted/arch/linux.c	2012-08-05 13:24:14.449768577 +0000
@@ -2415,6 +2415,11 @@
         ok = fscanf(fp, "%d", &range) == 1;
         fclose(fp);
 
+	/* starting at 2.6.28 partitions are OK but "range" doesn't show it */
+	if (dev->type == PED_DEVICE_MD && range == 1 &&
+	    _get_linux_version() >= KERNEL_VERSION (2,6,28))
+		ok = 0;
+
         /* (range <= 0) is none sense.*/
         return ok && range > 0 ? range : MAX_NUM_PARTS;
 }

Reply via email to