how do I use fdisk to correct a partition table overwritten by windows
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
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.
how do I use fdisk to correct a partition table overwritten by windows
I have 2 hard drives on my older computer, the older one with windows ME, and Mandrake, and the newer drive which has Kubuntu. What has happened, is that the id10ts that write the updates for Kubuntu started modifying the grub list.menu, and as a result they wrote over my boot menu before I was aware they had modified my grub conf menu.
The next time I booted up winME, it did a disk scan and completely over wrote my partitions and made one big C partition. I have not written to this disk since, and I have my original partition table saved and would like to re-write it to the hard-drive to recover my photos. ( I have photos on my fat 32 and my ext3 partitions )
My original partition table looks like this:
type name size start and end
/hda1 win95 fat32 C 2.9gig Cyl 0-382
/hda 5 " D 11gig Cyl 383-1877
/hda8 " E 11gig Cyl 3373-4865
/hda6 Ext2 Boot 2gig Cyl 1878-2139 ( 83 )
/hda9 ext3 /root 5.3gig cyl 2149-2849
/hda11 ext3 /home 3.7gig cyl 2881-3372
This is the table I want to restore, can someone give me a step by step of the commands I need to use to do the re-write. I know that it isn't that difficult to do, but it has been so long since I have had to do a repair that I want to ensure that I do it correctly the first time. All I want to do is recover my pictures and data, or maybe even get the Mandrake linux working again so that I can extract everything of value before the drive dies.
Thanks and Happy New Year,
Bob
If t'was me I'd use testdisk to do all the grunt work, but if you insist on fdisk...
Just run it (as root), then as it says, use "m" to see the commands you need. "n" to add a new partition - you may be able to give non-sequential partition numbers, I can't remember - then follow the prompts to use cylinder allocation.
"w" to write the disk, "yes" to confirm.
Reboot, and see what happens.
The first 4 partitions are in the MBR (1st sector of the disk), and then each logical partition (#5 and higher) is defined in a linked list using another partition table for each of the logical partitions.
Given that you have the data, it is certainly possible to re-construct things, but it will take a bit of hand work. It **might** be easier to just use Photorec.
One thing to consider is to clone the disk before starting to do anything.
Thanks All for the replies. I didn't think it was worth while to attempt to back up the corrupted contents because it is possible that winders has already overwritten my data. I'll have a look at test disk right now before I attempt the re-write.
Thanks for the ideas, and Happy New Year
Bob
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.