linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* 2.6.19 cannot find root partition
@ 2006-12-06 21:16 Anton Blanchard
  2006-12-06 21:24 ` Olaf Hering
  2006-12-06 22:22 ` David Gibson
  0 siblings, 2 replies; 6+ messages in thread
From: Anton Blanchard @ 2006-12-06 21:16 UTC (permalink / raw)
  To: olh, linuxppc-dev


Hi,

The patch to identify AIX disks and ignore them has caused at least one
machine to fail to find the root partition on 2.6.19. The patch is:

http://lkml.org/lkml/2006/7/31/117

The problem is some disk formatters do not blow away the first 4 bytes
of the disk. If the disk we are installing to used to have AIX on it,
then the first 4 bytes will still have IBMA in EBCDIC.

The install in question was debian etch. Im not sure what the best fix
is, perhaps the AIX detection code could check more than the first 4
bytes.

Anton

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

* Re: 2.6.19 cannot find root partition
  2006-12-06 21:16 2.6.19 cannot find root partition Anton Blanchard
@ 2006-12-06 21:24 ` Olaf Hering
  2006-12-06 22:22 ` David Gibson
  1 sibling, 0 replies; 6+ messages in thread
From: Olaf Hering @ 2006-12-06 21:24 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev

On Thu, Dec 07, Anton Blanchard wrote:

> The install in question was debian etch. Im not sure what the best fix
> is, perhaps the AIX detection code could check more than the first 4
> bytes.

Can you send me a dump of the first block?

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

* Re: 2.6.19 cannot find root partition
  2006-12-06 21:16 2.6.19 cannot find root partition Anton Blanchard
  2006-12-06 21:24 ` Olaf Hering
@ 2006-12-06 22:22 ` David Gibson
  2006-12-07  8:17   ` Olaf Hering
  2007-01-04  8:40   ` [PATCH] relax check for AIX in msdos partition table Olaf Hering
  1 sibling, 2 replies; 6+ messages in thread
From: David Gibson @ 2006-12-06 22:22 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, olh

On Thu, Dec 07, 2006 at 08:16:30AM +1100, Anton Blanchard wrote:
> 
> Hi,
> 
> The patch to identify AIX disks and ignore them has caused at least one
> machine to fail to find the root partition on 2.6.19. The patch is:
> 
> http://lkml.org/lkml/2006/7/31/117
> 
> The problem is some disk formatters do not blow away the first 4 bytes
> of the disk. If the disk we are installing to used to have AIX on it,
> then the first 4 bytes will still have IBMA in EBCDIC.
> 
> The install in question was debian etch. Im not sure what the best fix
> is, perhaps the AIX detection code could check more than the first 4
> bytes.

Yeah, I had this problem on paulus' old PReP machine - I had to
manually zap the AIX magic number to get it to see the perfectly good
partitions.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: 2.6.19 cannot find root partition
  2006-12-06 22:22 ` David Gibson
@ 2006-12-07  8:17   ` Olaf Hering
  2007-01-04  8:40   ` [PATCH] relax check for AIX in msdos partition table Olaf Hering
  1 sibling, 0 replies; 6+ messages in thread
From: Olaf Hering @ 2006-12-07  8:17 UTC (permalink / raw)
  To: linuxppc-dev

On Thu, Dec 07, David Gibson wrote:

> Yeah, I had this problem on paulus' old PReP machine - I had to
> manually zap the AIX magic number to get it to see the perfectly good
> partitions.

Something like this in aix_label_present should do it, beside
echo > /dev/sda

        struct partition *pt = (struct partition *) (p + 0x1be);
        int slot;
        for (slot = 1; slot <= 4; slot++, pt++) {
                if (pt->sys_ind == LINUX_SWAP_PARTITION ||
                        pt->sys_ind == LINUX_RAID_PARTITION ||
                        pt->sys_ind == 0x83 ||
                        pt->sys_ind == 0x8e ||
                        is_extended_partition(pt))
                        return 0;
        }                                                                                                                                                            

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

* [PATCH] relax check for AIX in msdos partition table
  2006-12-06 22:22 ` David Gibson
  2006-12-07  8:17   ` Olaf Hering
@ 2007-01-04  8:40   ` Olaf Hering
  2007-01-04 13:20     ` [PATCH] fix logic error in AIX detection Olaf Hering
  1 sibling, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2007-01-04  8:40 UTC (permalink / raw)
  To: Anton Blanchard, linuxppc-dev, Andrew Morton; +Cc: linux-kernel

On Thu, Dec 07, David Gibson wrote:

> On Thu, Dec 07, 2006 at 08:16:30AM +1100, Anton Blanchard wrote:

> > The patch to identify AIX disks and ignore them has caused at least one
> > machine to fail to find the root partition on 2.6.19. The patch is:
> > 
> > http://lkml.org/lkml/2006/7/31/117
> > 
> > The problem is some disk formatters do not blow away the first 4 bytes
> > of the disk. If the disk we are installing to used to have AIX on it,
> > then the first 4 bytes will still have IBMA in EBCDIC.
> > 
> > The install in question was debian etch. Im not sure what the best fix
> > is, perhaps the AIX detection code could check more than the first 4
> > bytes.
> 
> Yeah, I had this problem on paulus' old PReP machine - I had to
> manually zap the AIX magic number to get it to see the perfectly good
> partitions.

What pre-historic fdisk was used to create the partition table? At least
the current version of fdisk does not let me manipulate the existing
partition table before I remove the AIX marker. The patch below should
fix it. Partition table entries 2,3,4 from an AIX 4.3 install have type 0x41.

Also, the whole partition info for primary partitions is in this block:

  dd if=/dev/sdb count=$(( 4 * 16 )) bs=1 skip=$(( 0x1be ))

All other data do not matter, beside the 0x55aa marker at the end of the
first block.

Signed-off-by: Olaf Hering <olh@suse.de>

---
 fs/partitions/msdos.c |   12 +++++++++++-
 include/linux/genhd.h |    2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

Index: linux-2.6/fs/partitions/msdos.c
===================================================================
--- linux-2.6.orig/fs/partitions/msdos.c
+++ linux-2.6/fs/partitions/msdos.c
@@ -63,15 +63,25 @@ msdos_magic_present(unsigned char *p)
 #define AIX_LABEL_MAGIC4	0xC1
 static int aix_magic_present(unsigned char *p, struct block_device *bdev)
 {
+	struct partition *pt = (struct partition *) (p + 0x1be);
 	Sector sect;
 	unsigned char *d;
-	int ret = 0;
+	int slot, ret = 0;
 
 	if (p[0] != AIX_LABEL_MAGIC1 &&
 		p[1] != AIX_LABEL_MAGIC2 &&
 		p[2] != AIX_LABEL_MAGIC3 &&
 		p[3] != AIX_LABEL_MAGIC4)
 		return 0;
+	/* Assume the partition table is valid if Linux partitions exists */
+	for (slot = 1; slot <= 4; slot++, pt++) {
+		if (pt->sys_ind == LINUX_SWAP_PARTITION ||
+			pt->sys_ind == LINUX_RAID_PARTITION ||
+			pt->sys_ind == LINUX_DATA_PARTITION ||
+			pt->sys_ind == LINUX_LVM_PARTITION ||
+			is_extended_partition(pt))
+			return 0;
+	}
 	d = read_dev_sector(bdev, 7, &sect);
 	if (d) {
 		if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')
Index: linux-2.6/include/linux/genhd.h
===================================================================
--- linux-2.6.orig/include/linux/genhd.h
+++ linux-2.6/include/linux/genhd.h
@@ -21,6 +21,8 @@ enum {
 	WIN98_EXTENDED_PARTITION = 0x0f,
 
 	LINUX_SWAP_PARTITION = 0x82,
+	LINUX_DATA_PARTITION = 0x83,
+	LINUX_LVM_PARTITION = 0x8e,
 	LINUX_RAID_PARTITION = 0xfd,	/* autodetect RAID partition */
 
 	SOLARIS_X86_PARTITION =	LINUX_SWAP_PARTITION,

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

* [PATCH] fix logic error in AIX detection
  2007-01-04  8:40   ` [PATCH] relax check for AIX in msdos partition table Olaf Hering
@ 2007-01-04 13:20     ` Olaf Hering
  0 siblings, 0 replies; 6+ messages in thread
From: Olaf Hering @ 2007-01-04 13:20 UTC (permalink / raw)
  To: Anton Blanchard, linuxppc-dev, Andrew Morton; +Cc: linux-kernel


Correct the AIX magic check to let 'echo > /dev/sdb' actually work.

Signed-off-by: Olaf Hering <olh@suse.de>

---
 fs/partitions/msdos.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.20-rc3/fs/partitions/msdos.c
===================================================================
--- linux-2.6.20-rc3.orig/fs/partitions/msdos.c
+++ linux-2.6.20-rc3/fs/partitions/msdos.c
@@ -68,10 +68,10 @@ static int aix_magic_present(unsigned ch
 	unsigned char *d;
 	int slot, ret = 0;
 
-	if (p[0] != AIX_LABEL_MAGIC1 &&
-		p[1] != AIX_LABEL_MAGIC2 &&
-		p[2] != AIX_LABEL_MAGIC3 &&
-		p[3] != AIX_LABEL_MAGIC4)
+	if (!(p[0] == AIX_LABEL_MAGIC1 &&
+		p[1] == AIX_LABEL_MAGIC2 &&
+		p[2] == AIX_LABEL_MAGIC3 &&
+		p[3] == AIX_LABEL_MAGIC4))
 		return 0;
 	/* Assume the partition table is valid if Linux partitions exists */
 	for (slot = 1; slot <= 4; slot++, pt++) {

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

end of thread, other threads:[~2007-01-04 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-06 21:16 2.6.19 cannot find root partition Anton Blanchard
2006-12-06 21:24 ` Olaf Hering
2006-12-06 22:22 ` David Gibson
2006-12-07  8:17   ` Olaf Hering
2007-01-04  8:40   ` [PATCH] relax check for AIX in msdos partition table Olaf Hering
2007-01-04 13:20     ` [PATCH] fix logic error in AIX detection Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).