On Sat, Apr 06, 2002 at 05:00:28PM +0200, Pixel wrote: > > i don't quite know what will happen if you use this in diskdrake. diskdrake > will still propose to partition it.
Ahhhh, but in my case this was an upgrade I did, so diskdrake did not
even come up. I am not sure what would have happened, but for an
upgrade, it's not an issue. The only issue was the partition
detection.
> i agree it should get past the error
I got past it. Find below my patch to drakx in 8.2 to get it to go
past the problem of not finding partitions on lvm-only disks. I added
some useful information to the "no partition table found" type
messages as well. If somebody gets these errors, it is nice to know
which disk they are on.
Cheers,
b.
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table.pm
--- /mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table.pm
Sat Mar 16 07:30:29 2002
+++ /mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table.pm
+ Fri Apr 5 21:08:39 2002
@@ -455,8 +455,8 @@
if_(arch() =~ /^ia64/, 'gpt'),
arch() =~ /^sparc/ ? ('sun', 'bsd', 'unknown') : ('dos', 'bsd', 'sun',
'mac', 'unknown'),
);
- foreach ('empty', @parttype) {
- /unknown/ and die "unknown partition table format";
+ foreach ('empty', 'lvm', @parttype) {
+ /unknown/ and die "unknown partition table format on disk " . $hd->{file};
eval {
require("partition_table_$_.pm");
bless $hd, "partition_table_$_";
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_bsd.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_bsd.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_bsd.pm
Sat Mar 16 07:30:29 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_bsd.pm
+ Fri Apr 5 12:01:51 2002
@@ -78,8 +78,8 @@
} $info{partitions} =~ /(.{$size})/g;
- $info{magic} == $magic or die "bad magic number";
- $info{magic2} == $magic or die "bad magic number";
+ $info{magic} == $magic or die "bad magic number on disk " . $hd->{file};
+ $info{magic2} == $magic or die "bad magic number on disk " . $hd->{file};
[ @pt ], \%info;
}
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_dos.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_dos.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_dos.pm
Sat Mar 16 07:30:29 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_dos.pm
+ Fri Apr 5 11:54:45 2002
@@ -62,8 +62,8 @@
} (1..$nb_primary);
- sysread F, $tmp, length $magic or die "error reading magic number";
- $tmp eq $magic or die "bad magic number";
+ sysread F, $tmp, length $magic or die "error reading magic number on disk " .
+$hd->{file};
+ $tmp eq $magic or die "bad magic number on disk ". $hd->{file};
[ @pt ];
}
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_empty.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_empty.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_empty.pm
Sat Mar 16 07:30:29 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_empty.pm
+ Fri Apr 5 11:54:58 2002
@@ -25,8 +25,8 @@
c::lseek_sector(fileno(F), $sector, 0) or die "reading of partition in sector
$sector failed";
- sysread F, $tmp, 512 or die "error reading magic number";
- $tmp eq substr($tmp, 0, 1) x 512 or die "bad magic number";
+ sysread F, $tmp, 512 or die "error reading magic number on disk ". $hd->{file};
+ $tmp eq substr($tmp, 0, 1) x 512 or die "bad magic number on disk ". $hd->{file};;
partition_table_raw::zero_MBR($hd);
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_gpt.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_gpt.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_gpt.pm
Fri Apr 5 12:06:27 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_gpt.pm
+ Fri Apr 5 12:06:48 2002
@@ -106,7 +106,7 @@
sysread $F, $tmp, psizeof($main_format) or die "error while reading partition
table in sector $sector";
my %info; @info{@$main_fields} = unpack $main_format, $tmp;
- $info{magic} eq $magic or die "bad magic number";
+ $info{magic} eq $magic or die "bad magic number on disk " . $hd->{file};
$info{myLBA} == $sector or die "myLBA is not the same";
$info{headerSize} == psizeof($main_format) or die "bad partition table header
size";
$info{partitionEntrySize} == psizeof($partitionEntry_format) or die "bad
partitionEntrySize";
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_lvm.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_lvm.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_lvm.pm
Wed Dec 31 19:00:00 1969
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_lvm.pm
+ Tue Apr 9 04:31:46 2002
@@ -0,0 +1,73 @@
+package partition_table_lvm; # $Id: partition_table_lvm.pm,v 1.7 2001/10/19 11:23:35
+prigaux Exp $
+
+
+
+
+
+@ISA = qw(partition_table_raw);
+
+use common;
+use partition_table_raw;
+use partition_table;
+use c;
+
+my @fields = qw(active start_head start_sec start_cyl type end_head end_sec end_cyl
+start size);
+my $magic = "HM\1\0";
+
+my $offset = 0;
+
+sub hasExtended { 0 }
+
+sub compute_CHS($$) {
+ my ($hd, $e) = @_;
+ my @l = qw(cyl head sec);
+ @$e{map { "start_$_" } @l} = $e->{start} || $e->{type} ? CHS2rawCHS($hd,
+sector2CHS($hd, $e->{start})) : (0,0,0);
+ @$e{map { "end_$_" } @l} = $e->{start} || $e->{type} ? CHS2rawCHS($hd,
+sector2CHS($hd, $e->{start} + $e->{size} - 1)) : (0,0,0);
+ 1;
+}
+
+sub CHS2rawCHS {
+ my ($hd, $c, $h, $s) = @_;
+ if ($c > 1023) {
+
+ $c = 1023;
+ $h = $hd->{geom}{heads} - 1;
+ $s = $hd->{geom}{sectors};
+ }
+ ($c & 0xff, $h, $s | ($c >> 2 & 0xc0));
+}
+
+# returns (cylinder, head, sector)
+sub sector2CHS {
+ my ($hd, $start) = @_;
+ my ($s, $h);
+ ($start, $s) = divide($start, $hd->{geom}{sectors});
+ ($start, $h) = divide($start, $hd->{geom}{heads});
+ ($start, $h, $s + 1);
+}
+
+sub read {
+ my ($hd, $sector) = @_;
+ my $tmp;
+
+ local *F; partition_table_raw::openit($hd, *F) or die "failed to open device";
+ c::lseek_sector(fileno(F), $sector, $offset) or die "reading of partition in
+sector $sector failed";
+
+ sysread F, $tmp, length $magic or die "error reading magic number on disk " .
+$hd->{file};
+ $tmp eq $magic or die "bad magic number on disk ". $hd->{file};
+
+ [ ];
+
+}
+
+# write the partition table (and extended ones)
+# for each entry, it uses fields: start, size, type, active
+sub write($$$;$) {
+ my ($hd, $sector, $pt) = @_;
+
+ die "should not be writing lvm partitions!!";
+}
+
+sub clear_raw { { raw => [ ({}) x $nb_primary ] } }
+
+1;
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_mac.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_mac.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_mac.pm
Sat Mar 16 07:30:29 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_mac.pm
+ Fri Apr 5 11:57:57 2002
@@ -114,7 +114,7 @@
}
- $info{bzSig} == $magic or die "bad magic number";
+ $info{bzSig} == $magic or die "bad magic number on disk " . $hd->{file};
my $numparts;
c::lseek_sector(fileno(F), $sector, 516) or die "reading of partition in sector
$sector failed";
diff -urN --exclude *.dist
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_sun.pm
/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_sun.pm
---
/mnt/cooker/8.2/8.2-tree/Mandrake/mdkinst/usr/bin/perl-install/partition_table_sun.pm
Fri Apr 5 12:05:26 2002
+++
+/mnt/cooker/8.2/8.2-test/Mandrake/mdkinst/usr/bin/perl-install/partition_table_sun.pm
+ Fri Apr 5 12:05:06 2002
@@ -82,7 +82,7 @@
my %info; @info{@$main_fields} = unpack $main_format, $tmp;
- $info{magic} == $magic or die "bad magic number";
+ $info{magic} == $magic or die "bad magic number on disk " . $hd->{file};
compute_crc($tmp) == 0 or die "bad checksum";
--
Brian J. Murrell
msg62210/pgp00000.pgp
Description: PGP signature
