[PATCH] patch to use mylex RAID adapters

Phil pbi at cartel-info.fr
Thu Jan 3 16:17:18 CET 2002


Hi,

As you may know, mylex cards make disks appear as /dev/rd/cxdy (controller
x, disk y) and partitions as /dev/rd/cxdypz. This break some assuptions
done in setup_harddisks. This patch try to correct them, without breaking
the existing. It seems to work. Tell me what you think about it.

ps: don't forget : you can't use more than the seventh partition (c0d0p1
to c0d0p7).

Regards, Phil.

-- 
Philippe Biondi <pbi@ cartel-info.fr>   Cartel Informatique
Security Consultant/R&D                 http://www.cartel-info.fr
Phone: +33 1 44 06 97 94                Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2

-------------- next part --------------
--- /usr/lib/fai/nfsroot/sbin/setup_harddisk~	Fri Nov 16 17:56:16 2001
+++ /usr/lib/fai/nfsroot/sbin/setup_harddisk	Thu Jan  3 16:02:50 2002
@@ -238,7 +238,7 @@
     }
     $result = `sh -c "LC_ALL=C sfdisk -d -q"`;
     foreach $line(split(/\n/,$result)){
-	if($line =~ /# partition table of \/dev\/([a-z]+)/i){
+	if($line =~ /# partition table of \/dev\/(.+?)$/i){
 	   $disk = $1;
         }
 	if($line =~ /^\/dev\/(.+?)\s*:\s+start=\s*(\d+),\s+size=\s*(\d+),\s+Id=\s*([a-z0-9]+)\b(.*)$/i){
@@ -306,7 +306,7 @@
 	    if ($paras =~ / end/i){
 		$disk = "";
 	    } else {
-		if($paras =~ / (\/dev\/)?([a-z]+)/i){
+		if($paras =~ / (\/dev\/)?(.+)$/i){
 		    $disk = "$2";
 		    ($DiskMountpoints{$disk})
 		      && die "ERROR: there are more than one configuration of disk $disk.\n";
@@ -326,6 +326,9 @@
 	}
 
 	if ($disk){
+	    #for Mylex : partitions are /dev/rd/c0d0p1
+	    my $partletter = "";
+ 	    if($disk =~ /\//) { $partletter = "p"; }
 	    # primary|partition - command
 	    if($line =~ /^(primary|logical)\s+(.*)$/i){
 		$command = $1;
@@ -368,7 +371,7 @@
 		    ($PrimPartNo == 3) && ($disk =~ /^sd/) && ($PrimPartNo++);
                     ($PrimPartNo >4 ) && die "ERROR: Too much primary partitions (max 4).".
                                 " All logicals together need one primary too.\n";
-		    $MountpointPart{$mountpoint} = "$disk$PrimPartNo";
+		    $MountpointPart{$mountpoint} = "$disk$partletter$PrimPartNo";
 		    if($options =~ /\bboot\b/i){
 		        ($BootPartition) && die "ERROR: only one partition can be bootable at a time.";
 			$BootPartition = $MountpointPart{$mountpoint};
@@ -378,7 +381,7 @@
 		    ($NoMoreLogicals != 0) && die "ERROR: the logical partitions must be together.\n";
 		    $MPPrimary{$mountpoint} = "";
 		    $LogPartNo++;
-		    $MountpointPart{$mountpoint} = "$disk$LogPartNo";
+		    $MountpointPart{$mountpoint} = "$disk$partletter$LogPartNo";
 		    if (!$MPPrimary{$extmp}){
 		        $MPPreserve{$extmp} = "";
 		        $MPPrimary{$extmp} = "yes";
@@ -390,7 +393,7 @@
                         ($PrimPartNo >4 ) 
 			  && die "ERROR: too much primary partitions (max 4).".
                                " All logicals together need one primary too.\n";
-			$MountpointPart{$extmp} = "$disk$PrimPartNo";
+			$MountpointPart{$extmp} = "$disk$partletter$PrimPartNo";
 			$DiskMountpoints{$disk} .= " $extmp";
 		    }
 		    ($options =~ /\bboot\b/i) && die "ERROR: line $a, only primary partitions can be bootable.\n";
@@ -677,7 +680,9 @@
             $sfdiskTables{$disk} .= "$line\n";
 	}
 	print $sfdiskTables{$disk};
-	$filename = "/tmp/$disk.sfdisk";
+	( $filename = $disk) =~ s/\///g; 
+	$filename="/tmp/$filename.sfdisk";
+#	$filename = (($filename = $disk) =~ s/\///g, '/tmp' . $filename . '.sfdisk');
 	if(($test != 1) && ($filename)){
 	    open(FILE, ">$filename") || die "unable to write temporary file $filename\n";
 	    print FILE $sfdiskTables{$disk};


More information about the linux-fai mailing list