All of lore.kernel.org
 help / color / mirror / Atom feed
* partitionable md devices and partition detection
@ 2004-07-07  4:59 Georgi Georgiev
  2004-07-07  5:24 ` Neil Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Georgi Georgiev @ 2004-07-07  4:59 UTC (permalink / raw)
  To: LKML

What is the proper way to detect the partitions on a md device during kernel
initialization?

The real problem I am facing is that I cannot boot my root partition, which is
on /dev/md_d0p1, without using an initrd. The kernel complains that the device
md_d0p1 does not exist.

If I use md=d0,/dev/hdc1,/dev/hde1,/dev/hdg1,/dev/hdk1,/dev/hdm1, after the
system boots (and booting from an ordinary non-raid device), I only have
/sys/block/md_d0/, but nothing below it. Nothing about md_d0p1 is reported in
/proc/partitions either.

If I run fdisk on /dev/md_d0 the missing partition entries appear.

The same behavior is observed when autodetecting the raid array using raid=part
instead of the md=d0 line.

Thanks for any insight.

Please, do not remove me from the CC.

-- 
*)   Georgi Georgiev   *) April 1 This is the day upon which we are    *)
(*    chutz@gg3.net    (* reminged of what we are on the other three   (*
*)  +81(90)6266-1163   *) hundred and sixty-four. -- Mark Twain,       *)
(* ------------------- (* "Pudd'nhead Wilson's Calendar"               (*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: partitionable md devices and partition detection
  2004-07-07  4:59 partitionable md devices and partition detection Georgi Georgiev
@ 2004-07-07  5:24 ` Neil Brown
  2004-07-07 11:21   ` Georgi Georgiev
  2004-07-07 12:24   ` Miquel van Smoorenburg
  0 siblings, 2 replies; 5+ messages in thread
From: Neil Brown @ 2004-07-07  5:24 UTC (permalink / raw)
  To: Georgi Georgiev; +Cc: LKML

On Wednesday July 7, chutz@gg3.net wrote:
> What is the proper way to detect the partitions on a md device during kernel
> initialization?

Hmm... I guess there isn't.
I remember having a lot of trouble getting partitions to be recognised
when an array is first assembled, and deciding it was just easier to
leave it to user-space.  However that isn't an option when booting
without an initrd.

The following patch should make it work for the
  md=d0,....
case.  The "raid=part" case is a bit harder....

NeilBrown


diff ./init/do_mounts_md.c~current~ ./init/do_mounts_md.c
--- ./init/do_mounts_md.c~current~	2004-07-07 15:20:05.000000000 +1000
+++ ./init/do_mounts_md.c	2004-07-07 15:20:57.000000000 +1000
@@ -232,6 +232,8 @@ static void __init md_setup_drive(void)
 			err = sys_ioctl(fd, RUN_ARRAY, 0);
 		if (err)
 			printk(KERN_WARNING "md: starting md%d failed\n", minor);
+		else
+			sys_ioctl(fd, BLKRRPART, 0);
 		sys_close(fd);
 	}
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: partitionable md devices and partition detection
  2004-07-07  5:24 ` Neil Brown
@ 2004-07-07 11:21   ` Georgi Georgiev
  2004-07-07 12:24   ` Miquel van Smoorenburg
  1 sibling, 0 replies; 5+ messages in thread
From: Georgi Georgiev @ 2004-07-07 11:21 UTC (permalink / raw)
  To: Neil Brown; +Cc: LKML

maillog: 07/07/2004-15:24:04(+1000): Neil Brown types
> On Wednesday July 7, chutz@gg3.net wrote:
> > What is the proper way to detect the partitions on a md device during kernel
> > initialization?
> 
> Hmm... I guess there isn't.
> I remember having a lot of trouble getting partitions to be recognised
> when an array is first assembled, and deciding it was just easier to
> leave it to user-space.  However that isn't an option when booting
> without an initrd.
> 
> The following patch should make it work for the
>   md=d0,....
> case.  The "raid=part" case is a bit harder....
> 
> NeilBrown
> 
> 
> diff ./init/do_mounts_md.c~current~ ./init/do_mounts_md.c
> --- ./init/do_mounts_md.c~current~	2004-07-07 15:20:05.000000000 +1000
> +++ ./init/do_mounts_md.c	2004-07-07 15:20:57.000000000 +1000
> @@ -232,6 +232,8 @@ static void __init md_setup_drive(void)
>  			err = sys_ioctl(fd, RUN_ARRAY, 0);
>  		if (err)
>  			printk(KERN_WARNING "md: starting md%d failed\n", minor);
> +		else
> +			sys_ioctl(fd, BLKRRPART, 0);
>  		sys_close(fd);
>  	}
>  }

Shouldn't something, similar to the patch above, added to ./drivers/md/md.c do
the trick for the raid=part case?

I am way out of my league here, but looking at the above patch, wouldn't
something like the thing below do it (plus adding the appropriate header)?

I'll try the above suggestion when I get home.

--- /usr/src/linux/drivers/md/md.c.orig	2004-07-07 20:03:23.529156642 +0900
+++ /usr/src/linux/drivers/md/md.c	2004-07-07 20:18:50.845059260 +0900
@@ -1856,6 +1856,22 @@
 					export_rdev(rdev);
 			}
 			autorun_array(mddev);
+			if (part) {
+				int fd;
+				char name[16];
+
+				sprintf(name, "/dev/%s", mdname(mddev));
+				fd = sys_open(name, 0, 0);
+				if (fd < 0) {
+					printk(KERN_ERR 
+						"md: open failed - cannot"
+						"detect partitions on %s\n",
+						name);
+				} else {
+					sys_ioctl(fd, BLKRRPART, 0);
+					sys_close(fd);
+				}
+			}
 			mddev_unlock(mddev);
 		}
 		/* on success, candidates will be empty, on error

-- 
|    Georgi Georgiev   |  The surest sign that a man is in love is     |
|     chutz@gg3.net    |  when he divorces his wife.                   |
|   +81(90)6266-1163   |                                               |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: partitionable md devices and partition detection
  2004-07-07  5:24 ` Neil Brown
  2004-07-07 11:21   ` Georgi Georgiev
@ 2004-07-07 12:24   ` Miquel van Smoorenburg
  2004-07-12  3:36     ` Georgi Georgiev
  1 sibling, 1 reply; 5+ messages in thread
From: Miquel van Smoorenburg @ 2004-07-07 12:24 UTC (permalink / raw)
  To: linux-kernel

In article <16619.35060.821865.570842@cse.unsw.edu.au>,
Neil Brown  <neilb@cse.unsw.edu.au> wrote:
>On Wednesday July 7, chutz@gg3.net wrote:
>> What is the proper way to detect the partitions on a md device during kernel
>> initialization?
>> The real problem I am facing is that I cannot boot my root partition, which is
>> on /dev/md_d0p1, without using an initrd. The kernel complains that the device
>> md_d0p1 does not exist.
>
>Hmm... I guess there isn't.
>I remember having a lot of trouble getting partitions to be recognised
>when an array is first assembled, and deciding it was just easier to
>leave it to user-space.  However that isn't an option when booting
>without an initrd.

That's weird. It has been working for me out of the box.

>The following patch should make it work for the
>  md=d0,....
>case.

So the fact that it works for me is a freak accident?

I have this in lilo.conf:

append="md=d0,/dev/sda,/dev/sdb root=/dev/md_d0p1 "

and this is dmesg:

md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
md: Loading md_d0: /dev/sda
md: bind<sda>
md: bind<sdb>
raid1: raid set md_d0 active with 2 out of 2 mirrors
 md_d0: p1 p2 p3 < p5 p6 p7 p8 p9 p10 >
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.

Mike.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: partitionable md devices and partition detection
  2004-07-07 12:24   ` Miquel van Smoorenburg
@ 2004-07-12  3:36     ` Georgi Georgiev
  0 siblings, 0 replies; 5+ messages in thread
From: Georgi Georgiev @ 2004-07-12  3:36 UTC (permalink / raw)
  To: LKML

> So the fact that it works for me is a freak accident?
> 
> I have this in lilo.conf:
> 
> append="md=d0,/dev/sda,/dev/sdb root=/dev/md_d0p1 "
> 
> and this is dmesg:
> 
> md: Autodetecting RAID arrays.
> md: autorun ...
> md: ... autorun DONE.
> md: Loading md_d0: /dev/sda
> md: bind<sda>
> md: bind<sdb>
> raid1: raid set md_d0 active with 2 out of 2 mirrors
>  md_d0: p1 p2 p3 < p5 p6 p7 p8 p9 p10 >
> kjournald starting.  Commit interval 5 seconds
> EXT3-fs: mounted filesystem with ordered data mode.
> VFS: Mounted root (ext3 filesystem) readonly.

I guess my problem (and not only mine it seems) is here:

md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
md: Loading md_d0: /dev/hda
md: bind<hda>
md: bind<sda>
raid1: raid set md_d0 active with 2 out of 2 mirrors
 md_d0: unknown partition table

Why the unknown partition table? It does work fine once I complete booting.
This is with 2.6.7.

Don't pay attention to the hda,sda -- I was using vmware for the tests.

Sorry if I break the thread, but I had trouble finding the proper message to
reply to.

-- 
|    Georgi Georgiev   |  When you have eliminated the impossible,     |
|     chutz@gg3.net    |  whatever remains, however improbable, must   |
|   +81(90)6266-1163   |  be the truth. -- Sherlock Holmes, "The       |
|  ------------------- |  Sign of Four"                                |

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-07-12  3:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-07  4:59 partitionable md devices and partition detection Georgi Georgiev
2004-07-07  5:24 ` Neil Brown
2004-07-07 11:21   ` Georgi Georgiev
2004-07-07 12:24   ` Miquel van Smoorenburg
2004-07-12  3:36     ` Georgi Georgiev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.