Re: grub-install fails on software RAID

2013-11-15 Diskussionsfäden Thomas Lange
 On Wed, 30 Oct 2013 13:25:59 +0100 (CET), o...@v-brinkmann.de 
 o...@v-brinkmann.de said:

 /usr/sbin/grub-probe: Fehler: no such disk.
 Auto-detection of a filesystem of /dev/md0 failed.
 
 The same error occurs if I replace (md0) with (hd0) or (hd1), the 
only entries in /target/boot/grub/device.map.
Check if you have installed the mdadm package onto your install
client. When I forget this I also get the error message about
Auto-detection of a filesystem

I have to use (hd0) or similar when calling grub-install.
-- 
regards Thomas


Re: grub-install fails on software RAID

2013-11-15 Diskussionsfäden Thomas Lange
 On Wed, 30 Oct 2013 13:42:29 +0100, Markus Koeberl 
 markus.koeb...@tugraz.at said:

 I have scripts/GRUB_PC/20-raid in my config space with:
Thanks Markus,
it's a great idea to parse mdstat for getting the list of disks. I
modified your code and now I use this for installing grub onto all
disks. I just used this for a RAID1 on 4 disks. Works perfectly.
This is what I now added to GRUB_PC/10-setup:


# check if mdadm has been forgotten
if [ -f /proc/mdstat -a ! -d $target/etc/mdadm ]; then
echo WARNING: Found Software RAID, but mdadm was not installed
fi

# Check if RAID is used for the boot device
if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
raiddev=${BOOT_DEVICE#/dev/}
# install grub on all members of RAID
for device in `perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; 
s/\d+\[\d+\]//g; print }' /proc/mdstat`; do
echo Install grub on /dev/$device
$ROOTCMD grub-install --no-floppy /dev/$device
done
fi

-- 
regards Thomas


Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden o...@v-brinkmann.de
Thomas Lange la...@informatik.uni-koeln.de hat am 29. Oktober 2013 um 22:07 
geschrieben:
 
   GROOT=$(echo $GROOT | sed 's:md/:md:g')

 I've just read the git log. This minor patch is not needed any more in
 wheezy. That's why these lines were removed on Sep 8th. I guess you
 still have them in your script.

Yes, they are still there. But I don't think they do any harm, as the result of 
the call
 
$ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE
 
is (md0). It's
 
$ROOTCMD grub-install --no-floppy (md0)
 
that leads to
 
/usr/sbin/grub-probe: Fehler: no such disk.
Auto-detection of a filesystem of /dev/md0 failed.
 
The same error occurs if I replace (md0) with (hd0) or (hd1), the only 
entries in /target/boot/grub/device.map.
 
 If you use dracut instead of initramfs-tools you have to add rd.auto
 to the kernel command line, otherwise no RAID devices will be
 activated by dracut.
 
I did so, but that didn't improve the situation.
 
Olav

Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden Michael Senizaiz
I use a script to bypass partitioning since we have servers with 1-6 disks.
 Anything with more than 1 disk gets raided, so I have to pass the
following to /tmp/fai/disk_var.sh which is read in by the grub setup.  Make
sure you are using 1.2 metadata for your array. You don't have to bypass
partitioning, but a partition hook like below can populate the proper dev
path for MD (/dev/md/NUM) so grub doesn't look for the link that doesn't
exist (/dev/md0 - /dev/md/0)

#tail partition.NODECLASS:

if [ $PTYPE == fd ]; then
echo BOOT_DEVICE=/dev/md/0  /tmp/fai/disk_var.sh
else
echo BOOT_DEVICE=/dev/${diskarray[0]}1  /tmp/fai/disk_var.sh
fi








On Wed, Oct 30, 2013 at 7:25 AM, o...@v-brinkmann.de o...@v-brinkmann.dewrote:

 **
  Thomas Lange la...@informatik.uni-koeln.de hat am 29. Oktober 2013 um
 22:07 geschrieben:

 GROOT=$(echo $GROOT | sed 's:md/:md:g')
 
  I've just read the git log. This minor patch is not needed any more in
  wheezy. That's why these lines were removed on Sep 8th. I guess you
  still have them in your script.

  Yes, they are still there. But I don't think they do any harm, as the
 result of the call

  $ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE

  is (md0). It's

  $ROOTCMD grub-install --no-floppy (md0)

  that leads to

  /usr/sbin/grub-probe: Fehler: no such disk.
  Auto-detection of a filesystem of /dev/md0 failed.

  The same error occurs if I replace (md0) with (hd0) or (hd1), the
 only entries in /target/boot/grub/device.map.

   If you use dracut instead of initramfs-tools you have to add rd.auto
   to the kernel command line, otherwise no RAID devices will be
   activated by dracut.

  I did so, but that didn't improve the situation.

  Olav



Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden Markus Koeberl
On Wednesday 30 October 2013 13:25:59 o...@v-brinkmann.de wrote:
 Thomas Lange la...@informatik.uni-koeln.de hat am 29. Oktober 2013 um 
22:07 geschrieben:
GROOT=$(echo $GROOT | sed 's:md/:md:g')
  
  I've just read the git log. This minor patch is not needed any more in
  wheezy. That's why these lines were removed on Sep 8th. I guess you
  still have them in your script.
 
 Yes, they are still there. But I don't think they do any harm, as the
 result of the call
 
 $ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE
 
 is (md0). It's
 
 $ROOTCMD grub-install --no-floppy (md0)
 
 that leads to
 
 /usr/sbin/grub-probe: Fehler: no such disk.
 Auto-detection of a filesystem of /dev/md0 failed.
 
 The same error occurs if I replace (md0) with (hd0) or (hd1), the
 only entries in /target/boot/grub/device.map.
 
  If you use dracut instead of initramfs-tools you have to add rd.auto
  to the kernel command line, otherwise no RAID devices will be
  activated by dracut.
 
 I did so, but that didn't improve the situation.
 
 Olav

I have scripts/GRUB_PC/20-raid in my config space with:

# if raid.
if [ $(echo $BOOT_DEVICE | grep /dev/md /dev/null; echo $?) == 0 ]; then
  raiddev=${BOOT_DEVICE#/dev/}
  #get all member disks
  for device in `perl -pe 'if(/^'$raiddev'(.*)/){ if(/raid\d+\s(.*)/){ 
$var=$1; $var =~ s/\d+\[\d+\]//g; print $var\n; } }; $_=;' /proc/mdstat`; 
do
#install on all member disks
$ROOTCMD grub-install --no-floppy /dev/$device
  done
fi

-- 
Markus Koeberl
Graz University of Technology
Signal Processing and Speech Communication Laboratory
E-mail: markus.koeb...@tugraz.at


Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden Michael Senizaiz
Another post-script I run checks the status of the MD sync.  If the drive
isn't synced the boot sectors may not be on all member disks.  I have a
LAST script that waits for arrays to sync before rebooting (good idea
regardless).

If you have multiple arrays you can loop this.  I actually just have it
copied a few times for the array names we create.

LAST/10-mdsync:

if [ -b /dev/md/0 ]; then
while [[ `mdadm --detail /dev/md/0 |grep -i rebuild |wc -l` -ne 0 ]]
do
   echo sleeping 30s for resync
   sleep 30
done
   echo Synced, continuing
else
   echo No RAID, continuing
fi




On Wed, Oct 30, 2013 at 7:42 AM, Markus Koeberl markus.koeb...@tugraz.atwrote:

 On Wednesday 30 October 2013 13:25:59 o...@v-brinkmann.de wrote:
  Thomas Lange la...@informatik.uni-koeln.de hat am 29. Oktober 2013 um
 22:07 geschrieben:
 GROOT=$(echo $GROOT | sed 's:md/:md:g')
  
   I've just read the git log. This minor patch is not needed any more in
   wheezy. That's why these lines were removed on Sep 8th. I guess you
   still have them in your script.
 
  Yes, they are still there. But I don't think they do any harm, as the
  result of the call
 
  $ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE
 
  is (md0). It's
 
  $ROOTCMD grub-install --no-floppy (md0)
 
  that leads to
 
  /usr/sbin/grub-probe: Fehler: no such disk.
  Auto-detection of a filesystem of /dev/md0 failed.
 
  The same error occurs if I replace (md0) with (hd0) or (hd1), the
  only entries in /target/boot/grub/device.map.
 
   If you use dracut instead of initramfs-tools you have to add rd.auto
   to the kernel command line, otherwise no RAID devices will be
   activated by dracut.
 
  I did so, but that didn't improve the situation.
 
  Olav

 I have scripts/GRUB_PC/20-raid in my config space with:

 # if raid.
 if [ $(echo $BOOT_DEVICE | grep /dev/md /dev/null; echo $?) == 0 ]; then
   raiddev=${BOOT_DEVICE#/dev/}
   #get all member disks
   for device in `perl -pe 'if(/^'$raiddev'(.*)/){ if(/raid\d+\s(.*)/){
 $var=$1; $var =~ s/\d+\[\d+\]//g; print $var\n; } }; $_=;'
 /proc/mdstat`;
 do
 #install on all member disks
 $ROOTCMD grub-install --no-floppy /dev/$device
   done
 fi

 --
 Markus Koeberl
 Graz University of Technology
 Signal Processing and Speech Communication Laboratory
 E-mail: markus.koeb...@tugraz.at



Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden o...@v-brinkmann.de
 Markus Koeberl markus.koeb...@tugraz.at hat am 30. Oktober 2013 um 13:42 
 geschrieben:

 #install on all member disks
 $ROOTCMD grub-install --no-floppy /dev/$device

Even if I try
 
   $ROOTCMD grub-install --no-floppy /dev/sda
 
or /dev/sdb (which are returned by your perl one-liner), I get the same error 
message. It's like I'm missing something substantial ...
 
Olav

Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden Michael Senizaiz
When installing on a regular disk without raid use the partition number.
e.g. /dev/sda1.  When installing on an array use the array number /dev/md/0


On Wed, Oct 30, 2013 at 8:16 AM, o...@v-brinkmann.de o...@v-brinkmann.dewrote:

 **
   Markus Koeberl markus.koeb...@tugraz.at hat am 30. Oktober 2013 um
 13:42 geschrieben:
 
  #install on all member disks
  $ROOTCMD grub-install --no-floppy /dev/$device

  Even if I try

 $ROOTCMD grub-install --no-floppy /dev/sda

  or /dev/sdb (which are returned by your perl one-liner), I get the same
 error message. It's like I'm missing something substantial ...

  Olav



Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden Markus Koeberl
On Wednesday 30 October 2013 14:16:48 o...@v-brinkmann.de wrote:
  Markus Koeberl markus.koeb...@tugraz.at hat am 30. Oktober 2013 um
  13:42 geschrieben:
  
  #install on all member disks
  $ROOTCMD grub-install --no-floppy /dev/$device
 
 Even if I try
 
$ROOTCMD grub-install --no-floppy /dev/sda
 
 or /dev/sdb (which are returned by your perl one-liner), I get the same
 error message. It's like I'm missing something substantial ...
 
 Olav

I am using:
disk_config disk1 disklabel:gpt-bios align-at:4K
which creates a bios_grub partition at the beginning of the disk (sector 
2048-4095)

-- 
Markus Koeberl
Graz University of Technology
Signal Processing and Speech Communication Laboratory
E-mail: markus.koeb...@tugraz.at


Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden o...@v-brinkmann.de
 Michael Senizaiz trel...@gmail.com hat am 30. Oktober 2013 um 14:19 
 geschrieben:
 
  When installing on a regular disk without raid use the partition number. 
 e.g. /dev/sda1.  When installing on an array use the array number /dev/md/0
   
 
No matter where I try to install, I always get the error.
 
Olav


Re: grub-install fails on software RAID

2013-10-30 Diskussionsfäden o...@v-brinkmann.de
 Markus Koeberl markus.koeb...@tugraz.at hat am 30. Oktober 2013 um 14:42 
 geschrieben:

 I am using:
 disk_config disk1 disklabel:gpt-bios align-at:4K
 which creates a bios_grub partition at the beginning of the disk (sector
 2048-4095)

This indeed created a bios_grub partition, but didn't solve the grub-install 
problem:
 
Model: ATA Hitachi HUA72201 (scsi)

Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
3 1049kB 2097kB 1049kB primary bios_grub
1 2097kB 271MB 268MB primary raid
2 271MB 2418MB 2147MB ext4 primary raid

 

Olav

Re: grub-install fails on software RAID

2013-10-29 Diskussionsfäden Thomas Lange
 On Tue, 29 Oct 2013 13:10:00 +0100, Olav Brinkmann o...@v-brinkmann.de 
 said:

   disk_config raid fstabkey:uuid
   raid1   /boot   sda1,sdb1   ext4rw
   raid1   /   sda2,sdb2   ext4rw

 Everything seems OK so far, but during the installation run the default 
GRUB_PC/10-setup script fails at

 root@thehost:~# $ROOTCMD grub-install --no-floppy (md0)
 /usr/sbin/grub-probe: Fehler: no such disk.


 Are there any prerequisites that I'm possibly missing?
Which FAI version are you using?
Did you install the package mdadm onto this machine?

If this does not help, please attach the format.log and parts of
the shell.log (concerning the grub script).
-- 
regards Thomas


Re: grub-install fails on software RAID

2013-10-29 Diskussionsfäden andrew bezella
On Tue, 2013-10-29 at 13:10 +0100, Olav Brinkmann wrote:
[...] 
 Everything seems OK so far, but during the installation run the default 
 GRUB_PC/10-setup script fails at
 
 root@thehost:~# $ROOTCMD grub-install --no-floppy (md0)
 /usr/sbin/grub-probe: Fehler: no such disk.
 Auto-detection of a filesystem of /dev/md0 failed.
 Try with --recheck.
 If the problem persists please report this together with the output of 
 /usr/sbin/grub-probe --device-map=/boot/grub/device.map --target=fs -v 
 /boot/grub to bug-g...@gnu.org

hello -

i encountered a similar problem in ubuntu lucid and precise, where
attempts to install grub-pc onto a raid1 fail.  iirc i also hit it
during a recent debian upgrade, so i no longer think it's
ubuntu-specific (in the bug report below i make that claim).  it was a
different error message, but then again it's been awhile since my failed
attempts.  ymmv. 

the bug i commented on in hopes that it would be addressed: 
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/462171
was closed w/the note You need to install grub to the underlying
physical disks ( /dev/sda, /dev/sdb, etc ), not the raid array.  i've
edited the GRUB_PC/10-setup script to do that.  i've seen some comments
about superblock versions, etc. but i'm using the old .90 superblock on
the mirror underneath the rootfs w/o success.

however, (at the time) i also couldn't find anything explaining why this
had changed or grub2 docs detailing the issues.  so if anyone finds some
good related documentation (or counter-examples), please share!

thanks...

andy

-- 
andrew bezella abeze...@archive.org
Internet Archive



Re: grub-install fails on software RAID

2013-10-29 Diskussionsfäden Thomas Lange

I just installed a new webserver which uses RAID1 for / but
I have no separate /boot on this machine.

I've added two lines to GRUB_PC/10-setup:

faiserver[.../scripts/GRUB_PC] ~/fai-4.1/examples/simple/scripts/GRUB_PC/
15,17d14
 # see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606035
 GROOT=$(echo $GROOT | sed 's:md/:md:g')
 


And I also added this script GRUB_PC/20-mdadm-fix 

if ifclass webserver; then
   $ROOTCMD grub-install --no-floppy '(hd1)'
   $ROOTCMD grub-install --no-floppy '(hd2)'
fi

Not sure, if there's an easier way.


P.S.:
If you use dracut instead of initramfs-tools you have to add rd.auto
to the kernel command line, otherwise no RAID devices will be
activated by dracut.

-- 
regards Thomas


Re: grub-install fails on software RAID

2013-10-29 Diskussionsfäden Thomas Lange
 On Tue, 29 Oct 2013 21:52:25 +0100, Thomas Lange 
 la...@informatik.uni-koeln.de said:


 I've added two lines to GRUB_PC/10-setup:

 faiserver[.../scripts/GRUB_PC] ~/fai-4.1/examples/simple/scripts/GRUB_PC/
 15,17d14
  # see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606035
  GROOT=$(echo $GROOT | sed 's:md/:md:g')
  

I've just read the git log. This minor patch is not needed any more in
wheezy. That's why these lines were removed on Sep 8th. I guess you
still have them in your script.

-- 
regards Thomas


Re: grub-install fails on software RAID

2013-10-29 Diskussionsfäden Iordan Iordanov

Hello Thomas,

On the topic of FAI installs on RAIDed devices, is configuring RAID onto 
whole-disk devices now supported?


For example, our typical simple server is installed on a RAID1 mirror 
(/dev/md0) which sits on top of two unpartitioned devices /dev/sda and 
/dev/sdb. The partitions on the RAID device show up as /dev/md0p1, 
/dev/md0p2, etc.


This way, if a drive fails there is no preparation for the replacement 
drive necessary (partitioning), and since grub is installed onto the 
other device, it gets automatically synced by md.


We now use a custom hook to create this for us, but we'd like to move 
away from that and use built-in FAI functionality.


We also have more complicated set-ups, like a RAID10 device with near 
offset and two copies onto 6 disks (/dev/sda .. /dev/sdf). Two of those 
disks end up with a chunk containing the boot-loader at the start of the 
disk and are set as the boot devices. The same benefits to ease of 
replacement apply.


Thanks for any input!
iordan iordanov



On 10/29/13 17:07, Thomas Lange wrote:

On Tue, 29 Oct 2013 21:52:25 +0100, Thomas Lange 
la...@informatik.uni-koeln.de said:



  I've added two lines to GRUB_PC/10-setup:

  faiserver[.../scripts/GRUB_PC] 
~/fai-4.1/examples/simple/scripts/GRUB_PC/
  15,17d14
   # see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606035
   GROOT=$(echo $GROOT | sed 's:md/:md:g')
  

I've just read the git log. This minor patch is not needed any more in
wheezy. That's why these lines were removed on Sep 8th. I guess you
still have them in your script.