Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
The GRUB error stemmed from an attempt to wipe the MBR on /dev/sda1), which I had assumed was the device assigned to my usb stick. The filesystem under fdisk showed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12

    GRUB error 5


    The GRUB error stemmed from an attempt to wipe the MBR on /dev/sda1), which I had assumed was the device assigned to my usb stick. The filesystem under fdisk showed up as W95 so I thought there was no way it contained the MBR and instead was the usb stick formatted as vfat or something. After staring at the dreadful 'error 5' for awhile, I decided to try to use a hard drive tool included with UBCD to try to restore the MBR. That didn't help and probably only served to make things worse. Now there is no GRUB and it just says 'unable to boot OS' or something to that effect. I tried using a GRUB bootdisk but the only available root partitions are hdx and fd0 whereas my root drive was sdx. This is very likely due to the fact I setup the bootdisk on a different machine a few years back.

    I tried 'fdisk -lu' on a live cd but all it shows is information about my primary and secondary sata drives but the partitions on the hard drive containing the MBR are greatly reduced for some reason and all but /dev/sda1 and sda2 are mounted. Also, fdisk doesn't even cleanly exit without Ctrl+C.

    After fiddling around some more trying to recover the MBR without a backup on floppy; the situation is only getting worse, it seems.




    This might be a stupid question, but would it work if I were to replace my MBR with one from a different machine?

    Also, I've tried UBCD hard drive tools and many live cds--none of them are able to detect my primary drive. At the very least, I would like to backup my important data. The only partition I wiped was the one containing the MBR, so it certainly seems like I'd still be able to mount the drive.


    Am I at a complete loss or is there still hope?


    Thanks

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Hi and Welcome !

    First of all, MBR is not stored in any partition. It is stored in first sector of Hard Disk. Partitions has nothing to do with MBR.
    You can not copy and paste ( its not possible ) MBR of one machine to another because MBR contains Boot Loader, Partition Table and Hard Disk signatures.
    if, somehow, you copy MBR, everything stored in destination Hard Disk will be wiped out.

    We need a bit more info. Which Linux Distro do you have? Post the output of 'fdisk -l' command here.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12
    Sorry, my distro is Debian etch kernel 2.6.19.

    fdisk -l:
    -------------------------
    Disk /dev/sda: 320.0 GB

    Device
    /dev/sda1 ...... Linux
    -------------------------

    I've tried mounting the drive under many live cd's and I'm never successful. I'm using Ubuntu 7.04 right now. The partition information provided by fdisk is for the secondary hdd instead of the primary drive containing the MBR.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12
    Update: I was switching in and out hard drives and--all of a sudden--my primary drive showed up in the BIOS. I have no idea how I did it or what I did to fix the problem, but I was pleasantly surprised to say the least.

    Now, when I run fdisk, I see an LBA extended and Linux filesystem--/dev/sda1 & 2; respectively. Even more encouraging... when I run testdisk, it's able pick up all partitions with correct sizes, etc. Now it's just a matter of figuring out how to mount the darn things so I can use 'grub-install' to reinstall GRUB and hopefully get my MBR back to normal.

    I tried writing new MBR testdisk code to zero sector, but that did nothing.


    Any help in regards to where I go from here is much appreciated.
    Thanks

  6. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Download SuperGRUB CD .iso image, Burn it to CD and Boot from it. Select Re-install GRUB option from its Menu.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #6
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12
    Thanks for your help once again. I will give SuperGrub a shot. Just out of curiosity... is this easier than trying to mount the partitions and running 'grub-install'?

  8. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    SuperGRUB CD is very handy and easy to use. It has a lot of other features like Re-install Lilo and Windows Boot Loader.

    Kernel versions 2.6.20+ are using New IDE Drivers. These drivers assign common name ( sd ) to all types of Hard Disks. 'grub-install' does not work most of the time now.

    try this
    Code:
    mkdir  /mnt/debian
    mount /dev/<debian_partition>  /mnt/debain
    chroot /mnt/debian
    grub-install /dev/sda
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  9. #8
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12
    The only partition I'm able to mount is /dev/sda2, which translates to the /opt directory and is an extra partition I created with gparted many months after Debian was first installed.

    I am unable to mount /dev/sda1, which is apparently a superblock (primary partition?) as it appears in testdisk and contains all of the extended partitions under it.

  10. #9
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Post the complete output of fdisk -l command.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  11. #10
    Just Joined!
    Join Date
    Jul 2007
    Posts
    12
    fdisk -l:

    Disk /dev/sda: 80.0 GB, 80000000000 bytes
    255 heads, 63 sectors/track, 9726 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 1 8843 71031366 f W95 Ext'd (LBA)
    /dev/sda2 * 8844 9726 7092697+ 83 Linux


    Here is the testdisk output once I select the superblock...

    Disk /dev/sda - 79 GB / 74 GiB - CHS 9726 255 63
    Partition Start End Size in sectors
    L Linux 0 2 1 3038 254 63 48821409 [/]
    L Linux 3039 1 1 6685 254 63 58588992 [/usr]
    L Linux 6686 1 1 8509 254 63 29302497 [/home]
    L Linux 8510 1 1 8691 254 63 2923767 [/var]
    L Linux 8692 1 1 8752 254 63 979902 [/tmp]
    L Linux 8753 1 1 8764 254 63 192717 [/boot]
    L Linux Swap 8765 1 1 8842 254 63 1253007
    * Linux 8843 0 1 9725 254 63 14185395

Page 1 of 2 1 2 LastLast

Posting Permissions

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