LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MBR was filled with zeros (https://www.linuxquestions.org/questions/linux-software-2/mbr-was-filled-with-zeros-580420/)

n123 08-28-2007 09:43 AM

MBR was filled with zeros
 
hi all
today i used a live cd version of linux and boot with it.
first i use this command:
" dd if=/dev/hda of=/mnt/hda.0 bs=512 count=1 "
and then this command on my computer :
" dd if=/mnt/0.0 of=/dev/hda bs=512 count=1 "
0.0 is a text file with all zeros and has 512 bytes size.
but i forgot to save "hda.0" on a floppy disk to restore it later on MBR and reboot my computer. so this file was fully lost.
now the MBR was filled with "0", and i missed all of my partitions and OSes on my computer.

is there any trick or software , etc to restore the original my boot sector and partitios table on my computer.

thanks all
n123

kilgoretrout 08-28-2007 10:06 AM

There's a utlility called gpart, not to be confused with the partitioning tool, gparted. I haven't used gpart myself but it's purpose is to help recover your partition table if it gets corrupted. Here's an article that goes into gpart usage:

http://www.linux.com/articles/57748

I believe gpart is on knoppix and probably many other livecds.

pixellany 08-28-2007 02:26 PM

You also need to restore the boot code (GRUB?). That can be done from the live CD. My guess is that you need to restore the partitions first.

Note that "MBR" and "boot sector" are not the same thing. The MBR is the first sector of a drive, and is not associated with any partition. Boot sector is the first sector of a partition. The code you showed would in fact erase the MBR.


All times are GMT -5. The time now is 08:25 AM.