Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All, Why Knoppix: RHEL 4 does not have mkbootdisk, in the 64 bit distro, also when booting into 'linux rescue' I cannot find the grub command, that is why ...
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    11

    install MBR with GRUB from Knoppix

    Hi All,


    Why Knoppix: RHEL 4 does not have mkbootdisk, in the 64 bit distro, also when booting into 'linux rescue' I cannot find the grub command, that is why I'm using Knoppix.

    I have a test box that I'm trying to recover. RHEL 4 with 4 SCSI drives.

    /dev/sda1 is the /boot # This partition is outside the Raid 5
    /dev/sda2 is swap
    /dev/sda3 is part of the software raid

    The other drives contain swap and software raid partitions.

    Software raid 5 is /dev/md0

    In my test I'm failing sda3 with mdadm, as if I have lost the whole drive and then booting in with Knoppix to save the day. Next I rebuild the partitions, format the /dev/sda1 and copy the /boot info back to /dev/sda1 from backup copy I have on CD. Next I want to redo the MBR on /dev/sda, this is where I'm getting stuck on grub syntax.

    I need to tell grub about the location of /boot which is /dev/sda1, not sure how this is done from a Knoppix boot.

    Any Ideas Welcome!

    Joe

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,099
    Here are a couple ways of doing it and hopefully one of them will work for you:

    Boot with a Knoppix CD (or some other live-cd), or use a rescue/boot floppy like Tomsrtbt ( http://www.toms.net/rb/ ); determine your root partition and mount it to a temporary mount point; then chroot into it; then reinstall GRUB:

    sudo mkdir /mnt/temp

    sudo mount /dev/hda1 /mnt/temp
    (change /dev/hda1 to match your own root partition)

    sudo chroot /mnt/temp

    sudo grub-install /dev/hda

    or...

    determine your root partition, then mount it "dev" option enabled with write permissions. If the filesystem isn't mounted you'll need to mount it like this (be sure to change "hda1" and "hda" to match the location/device in your own system):

    sudo mount -o dev,rw /mnt/hda1

    if it's already mounted, remount it like this:

    sudo mount -o remount,dev,rw /mnt/hda1

    now restore grub like this:

    sudo chroot /mnt/hda1 grub-install /dev/hda

    if it doesn't work using chroot, try remounting as outlined above and do:

    sudo grub-install -root-directory=/mnt/hda1 /dev/hda
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Just Joined!
    Join Date
    Jun 2006
    Posts
    11
    Hello,

    Thanks for the reply. I don't think this will work because the / (root) partition is part of /dev/md0 (raid 5). I can mount the /dev/sda1 which contains /boot .

    I'm running this test on RHEL 4 32 bit and I have made a boot disk with mkbootdisk command, using the boot disk you can run grub and get everything back to normal on the new /dev/sda/ disk. But the real server is RHEL 4 64 bit and the mkbootdisk command is not available So trying to recover some other way on the test box without a RHEL 4 boot disk.

    When I first started this little test I made a copy of the MBR, I've been trying to re-install the MBR with:

    dd if=MBRbackup.bin of=/dev/sda bs=512 count=1

    It runs fine, but GRUB does not boot the system.

    I don't know, just seems to be little gotchas no matter which way I go.

    Thanks,

    Joe




    Quote Originally Posted by ozar
    Here are a couple ways of doing it and hopefully one of them will work for you:

    Boot with a Knoppix CD (or some other live-cd), or use a rescue/boot floppy like Tomsrtbt ( http://www.toms.net/rb/ ); determine your root partition and mount it to a temporary mount point; then chroot into it; then reinstall GRUB:

    sudo mkdir /mnt/temp

    sudo mount /dev/hda1 /mnt/temp
    (change /dev/hda1 to match your own root partition)

    sudo chroot /mnt/temp

    sudo grub-install /dev/hda

    or...

    determine your root partition, then mount it "dev" option enabled with write permissions. If the filesystem isn't mounted you'll need to mount it like this (be sure to change "hda1" and "hda" to match the location/device in your own system):

    sudo mount -o dev,rw /mnt/hda1

    if it's already mounted, remount it like this:

    sudo mount -o remount,dev,rw /mnt/hda1

    now restore grub like this:

    sudo chroot /mnt/hda1 grub-install /dev/hda

    if it doesn't work using chroot, try remounting as outlined above and do:

    sudo grub-install -root-directory=/mnt/hda1 /dev/hda

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...