LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2004, 02:32 AM   #1
Anjum Butt
LQ Newbie
 
Registered: Feb 2004
Location: Karachi, Pakistan
Distribution: Vector Linux, LFS
Posts: 5

Rep: Reputation: 0
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?
 
Old 02-17-2004, 05:13 AM   #2
Baldrick65
Member
 
Registered: Aug 2003
Location: Dunedin NZ
Distribution: Mint 13 Cinnamon
Posts: 653

Rep: Reputation: 31
Is there any particulay reason you don't want to use DOS FDISK?

Baldrick
 
Old 02-17-2004, 05:31 AM   #3
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Just to get this straight, are you just trying to boot /dev/hda2? If so, what kind of partition/filesystem is it?
 
Old 02-17-2004, 05:52 AM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
fdisk /mbr

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

regards

slackie
 
Old 02-18-2004, 12:43 AM   #5
Anjum Butt
LQ Newbie
 
Registered: Feb 2004
Location: Karachi, Pakistan
Distribution: Vector Linux, LFS
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
Old 02-18-2004, 04:20 AM   #6
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
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

Last edited by Demonbane; 02-18-2004 at 04:34 AM.
 
Old 02-18-2004, 04:28 AM   #7
Anjum Butt
LQ Newbie
 
Registered: Feb 2004
Location: Karachi, Pakistan
Distribution: Vector Linux, LFS
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
Old 02-18-2004, 05:11 AM   #8
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
As long as your lilo.conf file is OK just rerun lilo.
 
Old 02-18-2004, 07:19 AM   #9
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
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
 
Old 02-25-2004, 03:12 AM   #10
Anjum Butt
LQ Newbie
 
Registered: Feb 2004
Location: Karachi, Pakistan
Distribution: Vector Linux, LFS
Posts: 5

Original Poster
Rep: Reputation: 0
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?
 
Old 02-25-2004, 03:45 AM   #11
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Not that I'm aware of
 
Old 04-25-2009, 06:13 AM   #12
robajz
LQ Newbie
 
Registered: Apr 2009
Distribution: Debian
Posts: 4

Rep: Reputation: 0
testdisk does restore DOS MBR

Quote:
Originally Posted by Anjum Butt View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fdisk /MBR Eugney Slackware 39 08-23-2011 10:30 AM
WinXP fixmbr = DOS fdisk /mbr WhatsHisName Linux - General 4 05-06-2004 06:53 PM
fdisk /mbr rharvey@cox Linux - Software 2 02-16-2004 01:19 PM
PartitionMagic 7.0 and DOS fdisk don't work anymore gfischer Linux - Newbie 1 08-17-2003 03:09 PM
Need to uninstall Linux; problem with DOS fdisk mcleodnine Linux - Software 4 07-08-2001 02:24 AM


All times are GMT -5. The time now is 03:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration