Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-10-2005, 11:50 PM
|
#1
|
Member
Registered: Jan 2003
Location: New Haven, CT
Distribution: RedHat 8.0
Posts: 54
Rep:
|
Using Linux's fdisk to erase or fix a MBR?
My friend somehow managed to write a MBR to his new IDE hard drive. Now his OS won't boot whenever it's plugged in because his compute reads the IDE drive first while his OS is on a SATA drive. He's tried changing order but doesn't seem to work.
I suggested using Knoppix to boot and use fdisk to erase the MBR. However, is fdisk capable of this?
Thanks.
|
|
|
Click here to see the post LQ members have rated as the most helpful post in this thread.
|
03-11-2005, 12:06 AM
|
#2
|
Member
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154
Rep:
|
i do not know whethere fdisk can or not, but you friend could try and use the "dd" command to perfectly erase the entire mbr. I accidently did this on my computer and i lost my partition tables and everything on the MBR a month ago or so.
|
|
|
03-11-2005, 12:29 AM
|
#3
|
Member
Registered: Jan 2003
Location: New Haven, CT
Distribution: RedHat 8.0
Posts: 54
Original Poster
Rep:
|
How would you do that with dd?
I don't understand the command very well and have only really seen it used a few times before.
|
|
|
03-11-2005, 03:30 AM
|
#4
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,392
|
Re: Using Linux's fdisk to erase or fix a MBR?
Quote:
Originally posted by Comatose51
My friend somehow managed to write a MBR to his new IDE hard drive. Now his OS won't boot whenever it's plugged in because his compute reads the IDE drive first while his OS is on a SATA drive. He's tried changing order but doesn't seem to work.
|
This doesn't sound right.
Sounds like the BIOS isn't recognising the SATA as a primary disk if an IDE is present. The BIOS boots the primary disk - no ifs, no buts.
It doesn't cycle through to other disks.
Sounds like you mate needs a BIOS update - or a new motherboard.
Quote:
I suggested using Knoppix to boot and use fdisk to erase the MBR. However, is fdisk capable of this?
|
Won't help - not a function of fdisk, and see comment above.
|
|
|
03-11-2005, 12:34 PM
|
#5
|
Member
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 251
Rep:
|
Or how about using the Knoppix CD to install LILO to the MBR of the IDE drive?

|
|
|
03-11-2005, 09:01 PM
|
#6
|
Member
Registered: Jan 2003
Location: New Haven, CT
Distribution: RedHat 8.0
Posts: 54
Original Poster
Rep:
|
Quote:
Originally posted by camelrider
Or how about using the Knoppix CD to install LILO to the MBR of the IDE drive?
|
Friend is afraid of Linux. Wanted to use the opportunity to show him how useful Linux is and then go from there... Alas, the lack of a quick answer persuaded him to install Windows XP on the hard drive and just migrate OS hard drives.... 
|
|
|
03-12-2005, 05:34 PM
|
#7
|
Member
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154
Rep:
|
you probably don't need the dd command anymore, but if the mbr does mess up for no reason,
dd if=/dev/zero of=/dev/HD count=1 bs=512
HD is your hard drive letter
though, i'm guessing you're not going to need that anymore, and it's best not to, it ruined my partition tables 
|
|
|
03-12-2005, 06:03 PM
|
#8
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,392
|
Quote:
Originally posted by tsphan
you probably don't need the dd command anymore, but if the mbr does mess up for no reason,
dd if=/dev/zero of=/dev/HD count=1 bs=512
HD is your hard drive letter
though, i'm guessing you're not going to need that anymore, and it's best not to, it ruined my partition tables
|
The reason it ruined your partition table is because you told it to.
The first sector is conventionally referred to as the MBR; as we all know - the MBR is *NOT* just the executable code we like to refer to as the boot-loader.
That executable code must be contained within the first 446 bytes. The description for (up to) 4 partitions follows - that is your "partition table".
All contained within that 512 byte sector - which the above command zeroes out as requested.
|
|
2 members found this post helpful.
|
03-12-2005, 07:55 PM
|
#9
|
Member
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154
Rep:
|
Quote:
Originally posted by syg00
The reason it ruined your partition table is because you told it to.
The first sector is conventionally referred to as the MBR; as we all know - the MBR is *NOT* just the executable code we like to refer to as the boot-loader.
That executable code must be contained within the first 446 bytes. The description for (up to) 4 partitions follows - that is your "partition table".
All contained within that 512 byte sector - which the above command zeroes out as requested.
|
I found that out after I reformatted and some people told me that the MBR contained the partition tables  . Believe me, I learned a valuable lesson about the MBR that day.
|
|
|
03-12-2005, 08:05 PM
|
#10
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,392
|
Quote:
Originally posted by tsphan
Believe me, I learned a valuable lesson about the MBR that day.
|
Would (probably) work with say BS=440.
Should be o.k., but I've never tried it - must set up that test machine and give it a go one day.
|
|
|
03-12-2005, 08:18 PM
|
#11
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
Quote:
you probably don't need the dd command anymore, but if the mbr does mess up for no reason,
|
NO NO NO!!!
This will wipe out partition table.
To use dd to clear the boot code from a standard DOS MBR, do it this way:
Code:
dd if=/dev/zero of=/dev/hda/ bs=446 count=1
This will wipe out the first 446 bytes, and stop just short of the beginning of the partition table.
Last edited by jiml8; 03-13-2005 at 09:39 PM.
|
|
2 members found this post helpful.
|
03-12-2005, 11:34 PM
|
#12
|
Member
Registered: Jan 2003
Location: New Haven, CT
Distribution: RedHat 8.0
Posts: 54
Original Poster
Rep:
|
Damn.
New respect for *nix. dd is just too cool... too powerful to contemplate, yet so simple. That's what I love about *nix. I can do whatever hell I want with my computer, as long as it works in concept. Linux is free as in freedom AND beer! 
|
|
|
03-13-2005, 08:46 PM
|
#13
|
Member
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154
Rep:
|
bs=446 eh?
Maybe i should try that out again! Just joking, I'm afraid to even touch that dd command now.
|
|
|
03-13-2005, 09:41 PM
|
#14
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
Yup. Partition table starts at the next byte.
|
|
|
07-29-2007, 09:45 AM
|
#15
|
LQ Newbie
Registered: Jul 2007
Posts: 1
Rep:
|
bump, this thread is probably ancient, but just helped me out.
Apparently grub does not like letting go of your mbr if/when you decide to go back to windows 
|
|
|
All times are GMT -5. The time now is 09:07 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|