On Fri, Sep 02, 2011 at 12:39:37PM +0000, Dorau, Lukasz wrote:
> Summary:
> 
> parted (v.2.3) does not create new /dev/ devices for newly created partitions
> (second and next) on RAID device
> 
> Novell's Bugzilla: #715695
> 
> https://bugzilla.novell.com/show_bug.cgi?id=715695

The bug is not publicly I'm afraid. But there is another bug, which
has the same root cause and is publicly accessible:
https://bugzilla.novell.com/show_bug.cgi?id=567652

> Details:
> 
> I have RAID0 device (MD) on two phisical disks. I have created 3 primary
> partitions on it. There were all 3 partitions in the partition table, but only
> one new device appeared in /dev/ filesystem (only for the first of these three
> partitions).
> 
[SNIP]

I'm attaching a patch that fixes it with request for comments - is
replacing range with ext_range the right thing to do or am I missing
something important?



Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode
From 77f1d6abdbdf42a17f331ca1d0b55d1163e390db Mon Sep 17 00:00:00 2001
From: Petr Uzel <[email protected]>
Date: Mon, 5 Sep 2011 15:16:15 +0200
Subject: [PATCH] libparted: use ext_range to find out largest possible partition

Parted uses /sys/block/DEV/range file to find out how many partitions
can the blockdevice hold and uses this number in its algorithm
for informing the kernel about modified partitions. This works
fine for most devices, however, it fails on partitionable MD arrays,
because these have 1 in range file. Using ext_range should be safer
and work for all devices.

* libparted/arch/linux.c (_device_get_partition_range): Use
/sys/block/DEV/ext_range instead of range sysfs file

Signed-off-by: Petr Uzel <[email protected]>
---
 libparted/arch/linux.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index bc42750..5eb1471 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2416,7 +2416,7 @@ _blkpg_remove_partition (PedDisk* disk, int n)
 
 /*
  * The number of partitions that a device can have depends on the kernel.
- * If we don't find this value in /sys/block/DEV/range, we will use our own
+ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own
  * value.
  */
 static unsigned int
@@ -2427,7 +2427,7 @@ _device_get_partition_range(PedDevice* dev)
         FILE*       fp;
         bool        ok;
 
-        r = snprintf(path, sizeof(path), "/sys/block/%s/range",
+        r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range",
                      last_component(dev->path));
         if (r < 0 || r >= sizeof(path))
                 return MAX_NUM_PARTS;
-- 
1.7.3.4

Attachment: pgp4qxguAUWc3.pgp
Description: PGP signature

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/parted-devel

Reply via email to