Re: [PATCH 3/4] brd: Fix all partitions BUGs

From: Ross Zwisler
Date: Thu Aug 07 2014 - 14:57:22 EST


On Thu, 2014-08-07 at 12:11 +0300, Boaz Harrosh wrote:
> On 08/07/2014 02:06 AM, Ross Zwisler wrote:
> > Also, it looks like you can still create a new device with this patch, but you
> > can't create partitions on that device. Not sure if this is just what you get
> > when you dynamically create a device on the fly, or if it's a symptom of
> > something larger.
> >
>
> What? I just tried again this all works fine for me, here with fdisk.
> $ modprobe brd # will create ram0-7
> $ mknod /dev/ram8 b 1 8
> $ fdisk /dev/ram8
> g, n, , , +2M, n, , , , , w
>
> I create 2 partitions 2M each and press w and it is all there.
>
> What numbers did you use ? rd_nr, max_part, and the mknod numbers. Here it
> just works fine. What did you try?

Ah - it turns out the issue was that I wasn't following the naming scheme
"ramX" where X is your new device name. Here's the sequence:

# mknod /dev/ram_new b 1 6
# fdisk /dev/ram_new
< create some partitions>

This ends up creating a "ram_new" and a "ram6", which have the same
major/minor. The partitions do show up, but they live under ram6:

brw-rw---- 1 root disk 1, 6 Aug 7 12:36 ram6
brw-rw---- 1 root disk 259, 0 Aug 7 12:36 ram6p1
brw-rw---- 1 root disk 259, 1 Aug 7 12:36 ram6p2
brw-r--r-- 1 root root 1, 6 Aug 7 12:36 ram_new

You can run fdisk -l, etc, on ram_new, and it'll show you the partitions, they
just won't be surfaced in /dev. ram6 and ram_new seem to be alaises:

# fdisk -l /dev/ram_new

Disk /dev/ram_new: 8589 MB, 8589934592 bytes
64 heads, 32 sectors/track, 8192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2812942c

Device Boot Start End Blocks Id System
/dev/ram_new1 1 2049 2098160 83 Linux
/dev/ram_new2 2050 8192 6290432 83 Linux

This device aliasing happened with the old BRD code as well, so this isn't new
behavior.

- Ross


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/