LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to restore MBR without using dos fdisk? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-restore-mbr-without-using-dos-fdisk-147049/)

Anjum Butt 02-17-2004 01:32 AM

How to restore MBR without using dos fdisk?
 
Hello,

This is a strange problem.

I had accidental installed lilo on MBR and I need to remove it.

I had another one installed on the boot sector of second primary partition of my disk ( ie hda2 ).

My current disk layout shows the second partition marked active or boot able in fdisk but it doesn't boot.

now I want to remove the one installed on MBR and don't want to use DOS/Windows fdisk.

can anyone help me please?

Baldrick65 02-17-2004 04:13 AM

Is there any particulay reason you don't want to use DOS FDISK?

Baldrick

adz 02-17-2004 04:31 AM

Just to get this straight, are you just trying to boot /dev/hda2? If so, what kind of partition/filesystem is it?

slackie1000 02-17-2004 04:52 AM

fdisk /mbr

should work!!!
be careful !! this is a powerful thing...
fdisk won't ask confirmation...

regards

slackie

Anjum Butt 02-17-2004 11:43 PM

Quote:

Originally posted by Baldrick65
Is there any particulay reason you don't want to use DOS FDISK?

Baldrick

I have my reasons.

1. I believe that linux tools should be powerful, complete, self contained
and without the need of help from external resources.

2. I am pretty curious about doing it in linux without having to use any other available utility, especially those from MS world. ;)

3. I like to get my hands messy with grease.

I think you'll get the picture.

Demonbane 02-18-2004 03:20 AM

I think lilo stores a backup copy of the original mbr in something like /boot/boot.0300, try writing it back
Code:

dd if=/boot/boot.0300 of=/dev/hda bs=446 count=1

Anjum Butt 02-18-2004 03:28 AM

Quote:

Originally posted by Demonbane
I think lilo stores a back copy of the original mbr in something like /boot/boot.0300, try writing it back
Code:

dd if=/boot/boot.0300 of=/dev/hda bs=446 count=1

OK thanks,
My problem is solved.

But lets go an extra mile on this one.
Who knows, we might need it some day.

Lets suppose I don't have that copy, or might say that i don't have any copy of the previous mbr.

Then what should we do?

Any ideas?

If MS can do it, so can we.

adz 02-18-2004 04:11 AM

As long as your lilo.conf file is OK just rerun lilo.

Demonbane 02-18-2004 06:19 AM

Try this utility, it can write a mbr that can do what the standard dos mbr does, and more.
http://www.chiark.greenend.org.uk/~neilt/mbr/
the syntax to use should be something like
Code:

install-mbr /dev/hda -v --interrupt n --partition D --timeout 0
check the man page for more options

Anjum Butt 02-25-2004 02:12 AM

Quote:

Originally posted by Demonbane
Try this utility, it can write a mbr that can do what the standard dos mbr does, and more.
http://www.chiark.greenend.org.uk/~neilt/mbr/
the syntax to use should be something like
Code:

install-mbr /dev/hda -v --interrupt n --partition D --timeout 0
check the man page for more options

Isn't there a way to do it with fdisk or cfdisk?

Demonbane 02-25-2004 02:45 AM

Not that I'm aware of

robajz 04-25-2009 05:13 AM

testdisk does restore DOS MBR
 
Quote:

Originally Posted by Anjum Butt (Post 779781)
Isn't there a way to do it with fdisk or cfdisk?

Hi,

Code:

TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


Disk /dev/sdd - 65 MB / 62 MiB - CHS 500 8 32

[ Analyse  ]  Analyse current partition structure and search for lost partitions
[ Advanced ]  Filesystem Utils
[ Geometry ]  Change disk geometry
[ Options  ]  Modify options
[ MBR Code ]  Write TestDisk MBR code to first sector
[ Delete  ]  Delete all data in the partition table
[ Quit    ]  Return to disk selection






Note: Correct disk geometry is required for a successful recovery. 'Analyse'
process may give some warnings if it thinks the logical geometry is mismatched.



All times are GMT -5. The time now is 12:06 AM.