1

Alright here's how I got to this point.

I tried to partition my external drive so that I could install multiple OS's on it, 3 linux distros, 1 being ubuntu, and a partition for windows.

So I used Gparted and the drives came out fine according to it, but when I booted into windows to check from their it showed most of them as raw, so thinking something went wrong I decided to boot into Gparted again and just create a new partition table and start making new partitions again. Now after I created the new partition table all things just started going to hell and I finally realized I somehow screwed up the MBR.

Now the drive isn't recognized by Gparted half the time and it is unable to do anything to it.

So one person recommended I use MBR Repair to repair the MBR so I said sure, downloaded it and booted into it, and it recognized all my drives but the one with the corrupt mbr.

I've read you can manually repair the MBR and there are a few other tools that may be slightly better than MBR Repair but I figured I'd come here for a sound opinion.

I also read something about somebody using the same make drive to copy it's mbr and just replace the corrupted drives mbr, which makes me wonder, since I have ; Seagate 500 Gig Goflex (Corrupted MBR), Seagate 500 Gig desktop FreeAgent (Fine) and a Seagate 250 Gig Portable Expansion drive (Fine).

Braiam
  • 67,791
  • 32
  • 179
  • 269
William
  • 83
  • 1
  • 2
  • 6
  • Was that last paragraph a question? I can't know for sure that it's ok to use the MBR from one drive on another, The vendor could tell you if there's anything special needed for their equipment. If you want to try it you could use the unix dd command to copy the first sector of the source drive to the first sector of the drive where you want to put the copy. – John S Gruber May 20 '12 at 20:19

3 Answers3

1

I don't think anything was wrong with your MBR or your drive when the newly created partitions showed up as raw. I'm afraid I don't know why it sometimes can't be selected by the drop down menu in gparted. Some background may help you understand what should be happening, however.

First: the MBR. For an external drive the MBR is only a container for the primary partition table. That table takes up most of the last 64 bytes of the MBR, which is itself the first 512 bytes of data on the drive.

For a bootable drive the MBR contains code to load the beginning of grub, or to load the beginning of the first bootable partition (e.g. Windows or DOS). The latter is usually pretty interchangeable and you can use the Windows utilities to replace a vanilla one for that matter. If the drive needs something special there, however, it could use a special manufacturer provided MBR. For recent drives that's probably pretty unusual.

When you used gparted you specified a type for each partition. You should make sure that those are correct.

The partitions are raw until you create file systems on them. They can be Ext 3, for Unix, or NTFS or a version of FAT for Windows. For Ubuntu this is usually done by the Ubuntu installer. gparted wrote a new primary partition table at the end of the external disks MBR, and maybe wrote some other partition information elsewhere if you defined any external partitions. The Ubuntu installer will fill the partitions you tell it to with the file systems you tell it to create, wiping out any data there. Then they will no longer be raw (though the swap one will be).

When installing Ubuntu the system will also want to install GRUB2 to produce a boot window to select what system to boot. By default this goes on the primary disk (the one the system boots from). This changes the code in the first part of the MBR on that drive and installs Grub2 on some (usually) free space between the MBR and the end of the first track. (The MBR is the first sector of the first track of a drive).

Grub could also be installed on the MBR on secondary disk if you can tell your BIOS to boot from there.

It can also be installed into partitions on the secondary disk. If you do that you need to be sure the code in the MBR is good, the one installed by Windows would work fine. The partition with Grub installed would have to be marked as the bootable one.

When you are booting Windows, Grub finds the partition it is on and then loads the first sector of its partition, just like the original MBR did. When booting a Linux kernel Grub actually loads the whole kernel and starts it up.

Since the primary partition table takes up most of the last 64 of the last 66 bytes of the MBR you can't simply use a sector copy to replace it without wiping out your partition table. If you've done that, however, you should be able to use gparted to recreate it. gparted shouldn't wipe out the code part of the MBR in any case.

John S Gruber
  • 13,336
  • Ok here's the thing I just want to get the drive usable again.

    I don't mind wiping out the partition table I know that can be replaced.

    So if I was somehow able to copy and replace the corrupt MBR with the one from the other drive I could at least make it usable again correct?

    Remember the drive isn't even recognized on MBR repair and only half the time on gparted so I'm not even sure how I would go about doing that, I will test out other software to see if I can with it.

    Any more advice would be very helpful.

    – William May 19 '12 at 20:49
  • When you are able to access the drive with gparted what does it list as the device name (e.g. /dev/sdb)? – John S Gruber May 20 '12 at 05:21
  • I'm not convinced that there is a problem with your MBR. gparted shouldn't care about the MBR except to write to part of it. The first (MBR) sector is there for it to write into no matter what that sector contains. If you can give me the name from the device I may be able to give you a command to enter so we can take a look at your MBR. By the way, what message do you get with gparted when you try to change the partition table? – John S Gruber May 20 '12 at 05:26
  • Please read what I said again. – William May 20 '12 at 17:32
  • I read it several times. I just reread it. I've looked at MBR's and unassembled MBRs many times over almost 20 years. It doesn't bother me that some MBR recovery program doesn't see your external drive since I don't know anything about the recovery program. It did and does bother me to hear that gparted sees the drive some of the time and doesn't some of the time. By definition the MBR is the first sector of the drive, it may be mis-formatted but it always exists. You asked for some sound opinions and you have my opinion, sound or not. – John S Gruber May 20 '12 at 17:52
  • Two more items--because the external drive is coming and going, if I were with you I'd want to check drive cables and connectors. I had a kink in a drive ribbon cable once that drove me crazy. Second--I've always respected gparted and other partitioning tools, but I once wiped out data with it anyway. In the heat of experimentation it's easy to make a mistake. Please be careful with what drive and what partition you are changing. That's a lesson I learned the hard way. – John S Gruber May 20 '12 at 17:56
  • I already tested the drives cable and the connector to the external via a 80 gig sata that I tore out of a old laptop somebody was tossing just for that purpose.

    The cables and connector are fine I can say that for sure.

    What bothers me the the most, is as stated but you didn't say anything about was MBR Recover didn't even see the drive at all.

    Honestly I just want to get the drive working once again, 500 gigs is a lot of space I'd hate to lose the use of.

    I'm aware the MBR is always there, I just want to repair it somehow to get the drive working once again.

    In other words I'm looking

    – William May 20 '12 at 22:19
  • For a step by step, life is busy and it's hard to take the time to do the reading necessary to fix things like this myself. – William May 20 '12 at 22:19
1

Copying an MBR from One Drive to Another

This will wipe out the partition information, and therfore all of the information, on the target drive. If, by chance, the whole target drive contains a file system (the target drive is unpartitioned but formatted) it will wipe out that file system. Don't do this if you have any doubts and even then be sure you specify the drive names correctly.

If you want to try to copy an MBR from one drive to another, say from /dev/hda to /dev/sga here's one way:

  1. Make sure the drive itself, and any partitions on it, are unmounted. You can use the file folder right below the Window Dash button to see what is mounted and unmount anything that is mounted. It's in the sidebar under Devices on the top left. Click on the little eject button to unmount. If anything is mounted on the target drive I wouldn't expect to be able to write to the MBR using the method below, with an MBR recovery tool, or with gparted. This might be a good time to see if gparted can access the drive reliably.
  2. Open a terminal window. Enter the mount command without arguments to display everything mounted to be doubly sure nothing is mounted on the target drive.
  3. Enter a command similar to sudo dd if=/dev/sda of=/dev/sga bs=512 count=1, substituting /dev/sda with the source drive and /dev/sga with the target drive. This should copy the first sector of of the first drive to the first sector of the second. if= specifies the source and of= specifies the output.
John S Gruber
  • 13,336
0

The MBR is not the problem since you created a fresh one with gparted already, and even if it were wrong, would not make the whole drive not show up. Either there is a problem with the drive itself or the connection to it. Open the disk utility and run the SMART diagnostics on the drive.

psusi
  • 37,551