Some kernels report devices in /proc/partitions differently causing the FAI disk 
detection to fail. I'm sure there's some kernel option for this, but I've no idea what 
it is.

FAI expects /proc/partitions to be of the format:

pilsner:~# cat /proc/partitions 
major minor  #blocks  name

   3     0   39082680 hda
   3     1      32098 hda1
   3     2     104422 hda2
   3     3          1 hda3
   3     5     530113 hda5
   3     6     104391 hda6
   3     7      16033 hda7
   3     8    2048256 hda8
   3     9    2048256 hda9

Whereas, some kernels report it as:

pilsner:/tmp/fai# cat /proc/partitions
major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse running use 
aveq

   3     0   39082680 hda 6 18 48 110 0 0 0 0 0 110 110
   3     1      32098 hda1 0 0 0 0 0 0 0 0 0 0 0
   3     2     104422 hda2 0 0 0 0 0 0 0 0 0 0 0
   3     3          1 hda3 0 0 0 0 0 0 0 0 0 0 0
   3     5     530113 hda5 0 0 0 0 0 0 0 0 0 0 0
   3     6     104391 hda6 0 0 0 0 0 0 0 0 0 0 0
   3     7      16033 hda7 0 0 0 0 0 0 0 0 0 0 0
   3     8    2048256 hda8 0 0 0 0 0 0 0 0 0 0 0
   3     9    2048256 hda9 0 0 0 0 0 0 0 0 0 0 0

So, here's a patch that works for both cases:

--- /usr/share/fai/subroutines-linux.old        Mon Nov 11 09:14:32 2002
+++ /usr/share/fai/subroutines-linux    Mon Nov 11 10:33:30 2002
@@ -24,7 +24,7 @@
 disk_info() {
 
     # the variable holds a space separated list of devices and their block size
-    device_size=`egrep ' cciss/c.d.$| ida/c.d.$| rd/c.d.$| hd.$| sd.$|/disc$' 
/proc/partitions | diskandsize`
+    device_size=`egrep ' cciss/c.d.\b| ida/c.d.\b| rd/c.d.\b| hd.\b| sd.\b|/disc\b' 
+/proc/partitions | sed -e "s/\([a-z]\+ \).\+$/\1/" | diskandsize`
 
     # a list of all local disks, without size
     disklist=`list_disks $device_size`


-Bruce.

Reply via email to