LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to fix mbr in linux or gparted, etc. (for a mbr partitioned disk) (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-fix-mbr-in-linux-or-gparted-etc-for-a-mbr-partitioned-disk-4175423729/)

imayneed 08-24-2012 12:19 AM

How to fix mbr in linux or gparted, etc. (for a mbr partitioned disk)
 
I am used to using gpt disks, therefore I was using gptsync to fix mbr.

I do not know if gptsync can fix mbr in mbr disks, which I think not.

I am wondering if there is any command that I can use like gptsync to fix mbr of mbr disks.

Code:

sudo gptsync /dev/sdX
has always solved my problems on gpt disks.
But I don't know what can solve my problems in mbr disks.

And gptsync works if there is any grub or not in the drive.
That is the kind of solution I am looking for, even if there is no grub, can mbr be updated?
In gpt disks, whenever I have a problem, I can easily delete the first 200 MB Protective Partition and run gptsync, and everything would be fine.
Is there any solution like this for MBR disks?

Thanks.

schneidz 08-26-2012 09:37 AM

there is grub-install. if you got a backup of the partition table this mite work:
Code:

dd if=mbr.bak of=/dev/sdb bs=512 count=1

smallpond 08-26-2012 09:50 AM

Surely this can't be a common problem. What the heck are you doing that you need to recreate the mbr that often?

Anyway, the disk label can be written with parted. If you need a boot loader as well, then use grub-install.

gptsync creates a disk label (mbr partition table) from a gpt. If you don't have a gpt, and your mbr is corrupted, parted can find your partitions with "rescue" mode.


All times are GMT -5. The time now is 11:09 PM.