Grub grubby, need to tidy it up before 11.4

Hi guys, due to my bad a long time ago, my grub is a mess.
I have two HDD’s One has Win XP on sdb1, sdb2 is missing (?), sdb3 is extd partion, sdb4 is swap, sdb5 is / , sdb6 is /home, sdb 4,5,6 are my 11.2 install.

sda is a 120Gb ide drive, sdb is 300Gb SATA. Boots from 120Gb in bios
There is no OS on sda.

However, 11.1 * USED* to be on the other drive. (sda). 11.1 is long gone but sda’s MBR still has the grub on it, so I cannot boot 11.2 without sda being attached. If I detach it, sdb boots direct into Win XP
Here are some screenies of fdisk, df -h gparted and yast partitioner which might help.
partition pictures by wakou - Photobucket

Here is the output from please_try_again’s findgrub script tool:

stephen@home:~/bin> findgrub -a
Root User Permissions are required, Please Enter the ...

root's password:

Find Grub Version 2.4 - Written for openSUSE Forums


 - reading MBR on disk /dev/sda                    ... --> Grub found in MBR
 - reading bootsector  /dev/sda1   (LINUX)         ...
 - reading MBR on disk /dev/sdb                    ...
 - searching partition /dev/sdb1   (NTFS)          ... --> Windows NT/2K/XP Loader found in /dev/sdb1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sdb1
    rootnoverify (hd1,0)
    makeactive
    chainloader +1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - reading bootsector  /dev/sdb3   (Extended)      ...
 - skipping partition  /dev/sdb4   (swap)         
 - reading bootsector  /dev/sdb5   (LINUX)         ... --> Grub found in /dev/sdb5
 - reading bootsector  /dev/sdb6   (LINUX)         ...
 - reading bootsector  /dev/sdb7   (LINUX)         ...
 - reading MBR on disk /dev/sdc                    ...
 - reading bootsector  /dev/sdc1   (LINUX)         ...

 Bootflag can not be set: No Grub was found in primary or in the extended partition.


I have tried to stumble through YAST bootloader tools, and Kgrubeditor
YAST wants me to insert a floppy (!!! “err what’s a floppy dad?” “Well, son, before we had the internet…”)
Anyone give a nudge please?

I know I could detach the SATA drive, and boot to a WInXP CD and format /MBR on the 120Gb ide/sda but then I would not be able to boot 11.2, at all? Or could I then boot to 11.4 liveCD and repair it there?

So, I am not sure what you want to do here: In order to boot openSUSE from sdb, you would need to load the grub boot loader into the MBR of sdb and that is because the rest of grub is located in sdb5. You can only directly boot from partitions 1, 2, 3 or 4 but if you load grub into the MBR, the rest of the boot loader can be “booted” from partitions 5 or higher, which you normally can not do. Now another problem with sdb is if you load the MBR with grub and place it first in your BIOS, change its connection to the motherboard or just remove sda, your /boot/grub/device.map file will change and this will change which drive is listed as hd0 in the device.map file and the hd0 designations in the menu.lst file. One thing is for sure, you need to download and create a GParted boot disk. Here is an article from caf4926 that can be useful. Create and test this disk before taking any other action:

Re-Install Grub Quickly with Parted Magic

You would then need to tell us what are you doing with sda, what do you want to do with sdb and you need to give us a copy of the following files. Open a terminal session and execute these commands.

cat /boot/grub/device.map
cat /boot/grub/menu.lst
cat /etc/fstab

We could with this info and what you want to do make some sort of suggestion for you.

Thank You,

Thanks James, here are the files, I will be having a chew on caf’s tutorial:

cat /boot/grub/device.map
(hd2)   /dev/disk/by-id/usb-Maxtor_3200_2CAH87ZZ-0:0
(hd0)   /dev/disk/by-id/ata-ST3120022A_5JT3CL13
(hd1)   /dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G

(hd2) above is a storage USB removable, please ignore…

cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Mon Mar 14 19:52:14 GMT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd1,4)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.2
    root (hd1,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.2
    root (hd1,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1  x11failsafe vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: memtest86###
title Memory Test
    kernel (hd1,4)/boot/memtest.bin

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.37.2-0.6-default
    root (hd1,4)
    kernel /boot/vmlinuz-2.6.37.2-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.37.2-0.6-default

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.31.14-0.6-default
    root (hd1,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.31.14-0.6-debug
    root (hd1,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-debug root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-debug

and *note part2 below is commented out I deleted the partition and this was the only way I knew to get booted!
*

cat /etc/fstab
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4       swap    swap    defaults 0 0 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5       /       ext4    acl,user_xattr 1 1 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part6       /home   ext4    acl,user_xattr 1 2 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part1       /windows/C      ntfs-3g users,defaults,locale=en_GB.UTF-8 0 0 
#/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part2      /local          ext4    acl,user_xattr 1 2
proc    /proc   proc    defaults 0 0 
sysfs   /sys    sysfs   noauto 0 0 
debugfs /sys/kernel/debug       debugfs noauto 0 0 
devpts  /dev/pts        devpts  mode=0620,gid=5 0 0 



Let us just suppose, since you did not say, was that for now, you wanted to pull the 120 GB hard drive and use only the 300. Here is what you would do:

  1. With System Off, Disconnect 120 GB hard Drive and set aside.
  2. With a Live CD, boot from CD and mount /dev/sda5 (It would be sda if you removed the other drive and plugged this on into the place the old sda 120 GB drive was connected).
  3. Edit these files to now say:

/boot/grub/device.map

(hd0) /dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G
(hd1) /dev/disk/by-id/usb-Maxtor_3200_2CAH87ZZ-0:0

/boot/grub/menu.lst

# Modified by YaST2. Last modification on Mon Mar 14 19:52:14 GMT 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,4)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.2
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    rootnoverify (hd0,0)
    makeactive
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.2
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1  x11failsafe vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: memtest86###
title Memory Test
    kernel (hd0,4)/boot/memtest.bin

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.37.2-0.6-default
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.37.2-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.37.2-0.6-default

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.31.14-0.6-default
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-default

###Don't change this comment - YaST2 identifier: Original name: linux###
title Kernel-2.6.31.14-0.6-debug
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.31.14-0.6-debug root=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5 resume=/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4 splash=silent quiet showopts vga=0x348
    initrd /boot/initrd-2.6.31.14-0.6-debug
/etc/fstab

/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part4       swap    swap    defaults 0 0 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part5       /       ext4    acl,user_xattr 1 1 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part6       /home   ext4    acl,user_xattr 1 2 
/dev/disk/by-id/ata-Maxtor_7L300S0_L60LCJ0G-part1       /windows/C      ntfs-3g users,defaults,locale=en_GB.UTF-8 0 0 
proc    /proc   proc    defaults 0 0 
sysfs   /sys    sysfs   noauto 0 0 
debugfs /sys/kernel/debug       debugfs noauto 0 0 
devpts  /dev/pts        devpts  mode=0620,gid=5 0 0

I left the filename at the top of each, but you would not really have that there.

  1. You would follow caf’s instructions on how to reinstall grub into the MBR of your new /dev/sda (was /dev/sdb) hard drive.

Of course, you could just pull your old 120 GB disk sda and reinstall openSUSE to your new sda. You could pick custom partitioning, and select the exact same places for each except you would not format /home, but allow it to reload the root / partition. This would require you to load all of your old applications, but all of your settings would be retained. Grub would be reloaded properly and your menu.lst. device.map and fstab files would be rebuilt properly.

Thank You,

James, TYVM… linux would be a cold and lonely place without people like you (and Caf, and oldcpu, and everyone… :slight_smile: )
I was just about to re install anyway, so I guess I just pull the 120Gb, and install 11.4 on the 300Gb as you advise above. Then pull 300Gb put in 120Gb and format /mbr from a Win boot/rescue disk. Replace 300Gb and set it as 1st boot in BIOS and all should be shiny and new and beautiful…
Knowing I have this “back up” plan…
I think I might try to follow your instructions above, just to get over my grubphobia. Or not.
Thanks again!

(

James, TYVM… linux would be a cold and lonely place without people like you (and Caf, and oldcpu, and everyone… :slight_smile: )
I was just about to re install anyway, so I guess I just pull the 120Gb, and install 11.4 on the 300Gb as you advise above. Then pull 300Gb put in 120Gb and format /mbr from a Win boot/rescue disk. Replace 300Gb and set it as 1st boot in BIOS and all should be shiny and new and beautiful…
Knowing I have this “back up” plan…
I think I might try to follow your instructions above, just to get over my grubphobia. Or not.
Thanks again!
Happy to help. Don’t forget you will be enabling grub into the MBR and disabling it into the openSUSE partition. Similar verbage exists to that effect under the booting section during the installation, but I don’t recall exactly what is says there. You just got to ask for more help if it is needed.

Thank You,

Good morning James…
Ty for the guidance, fresh install was OK regards partitions/disks/grub etc
Except for a minor panic when I manged to crash partedMagic WHILST IT WAS IN THE MIDDLE OF RESIZING A PARTITION
D’OH!
Luckily I was “playing” with moving and resizing on the disk which I was to overwrite and had all backed up safe (I think, not restored yet!)

Good morning James…
Ty for the guidance, fresh install was OK regards partitions/disks/grub etc
Except for a minor panic when I manged to crash partedMagic WHILST IT WAS IN THE MIDDLE OF RESIZING A PARTITION
D’OH!
Luckily I was “playing” with moving and resizing on the disk which I was to overwrite and had all backed up safe (I think, not restored yet!)

Good morning wakou, it is 6:00 am Tuesday morning here. Do keep us informed of your status. I don’t like the sound of getting a panic while running a resize command.

Thank You,