LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Urgent. Need to recover a partition (https://www.linuxquestions.org/questions/ubuntu-63/urgent-need-to-recover-a-partition-573043/)

Neo-Leper 07-30-2007 07:39 PM

I checked out that post. It seems straight forward enough. Since I recovered all that I could I am not to worried if it fails, though I would love it if this works. I am cutting and pasting part of post #50 here and changing the hda to sda.

First two questions.

1- Can I do this from my installed Ubuntu or should I use my SystemRescueCD 0.3.5?
2 - sda is not bootable but this should work?

Quote:

"""In any case, assuming that the first partition is supposed to be a physical partition and not an extended one, I'll talk you through the changes which should make it bootable (there is a windows boot manager in the MBR at the present time). Follow these instructions EXACTLY, and if you get confused, DO NOT PROCEED: ASK!

First, you need to make a copy of the MBR to work on. Working as root from the live CD, do it this way:

dd if=/dev/sda of=mbrimage.bin bs=512 count=1

This will create a file called mbrimage.bin in the directory /root.

Now, start khexedit. If you do not have khexedit, figure out what hex editor you have and start it.

khexedit mbrimage.bin

When khexedit starts, you will see a display window that looks a lot like the hex output I had you create earlier.

Look for this data, which starts at location 0x01b0 (should be an entire line in the editor)
Code:

00 00 00 00 00 2c 44 63 f8 17 f8 17 00 00 00 00


change it exactly as I show it (change is in bold)
Code:

00 00 00 00 00 2c 44 63 f8 17 f8 17 00 00 80 00


Now move down to the next line which is this:
Code:

01 01 15 fe ff ff c1 3e 00 00 be d8 5f 09 00 fe


Change it exactly as I show it (change is in bold)
Code:

01 01 07 fe ff ff c1 3e 00 00 be d8 5f 09 00 fe


Now save the changes.

Now write the modified MBR back to the hard drive:

dd if=mbrimage.bin of=/dev/sda bs=512 count=1""

jiml8 07-30-2007 07:56 PM

You can do it from ubuntu, and the fact that sda doesn't have a bootable partition on it doesn't matter.

Neo-Leper 07-30-2007 08:06 PM

Quote:

Originally Posted by jiml8
You can do it from ubuntu, and the fact that sda doesn't have a bootable partition on it doesn't matter.


OK. I am going to give this a try. I am vaguely familiar with hex editors (editing cheat codes for games, etc,) So lets see if I can do this right. Thanks.

Neo-Leper 07-30-2007 08:29 PM

LMAO.... Well,

I am not sure what I screwed up but I have decided to do something. I am setting up my older computer and teaching myself some new things. For ex. I am going to install Linux and probably Win98 and create problems and then see if I can fix them correctly (starting first with recreating this problem,) and doing that as many times as I need to until I get it right.

I somehow got the first partition to fill the whole drive (getting rid of the second partition.) No big deal, so I used the backup mbrimage.bin I created and put that back. I got all the correct sizes back but partition 2 is unallocated (I think I now what to do to fix that.) I just knew I was going to do something like that but it is helping me understand a few more things about this, which is why I want to set up my older computer and learn more.

Either way thank you.

jiml8 07-30-2007 09:54 PM

Uhhh...

I guess I steered you a bit wrong. Post 50 told the person on that other thread how to fix her partition. Yours is different.

You would have wanted to change a type 82 to a type 83 partition.

What I really wanted you to do was post the contents of the MBR here on this board, as I had her do it on that other thread.

Neo-Leper 07-30-2007 10:11 PM

Quote:

Originally Posted by jiml8
Uhhh...

I guess I steered you a bit wrong. Post 50 told the person on that other thread how to fix her partition. Yours is different.

You would have wanted to change a type 82 to a type 83 partition.

What I really wanted you to do was post the contents of the MBR here on this board, as I had her do it on that other thread.


Ok. I misunderstood. I can still do that if it will still work?

jiml8 07-30-2007 10:12 PM

It certainly should still work

Neo-Leper 07-30-2007 10:15 PM

Ok Give me a minute and I will post it. Now to make sure I understand this you want the contents of the file that I get using khexedit?

Neo-Leper 07-30-2007 10:27 PM

Ok. I wanted to give you the exact file I saved originally before I started messing with it, unless you want the one that is there now, (both?). So I uploaded it in pdf format here http://free-voices.net/print.pdf

Neo-Leper 07-30-2007 10:29 PM

I also added this, the actual file gz http://free-voices.net/mbrimage.bin.gz

jiml8 07-30-2007 10:40 PM

Follow the instructions in post 42 of that other thread. This will give a hex listing of the MBR, and it will report what sfdisk -l has to say about the drive. The combination will give all the info needed to fix the partition table

jiml8 07-30-2007 10:40 PM

actually that pdf works as well...wait a minute...

Neo-Leper 07-30-2007 10:42 PM

ok, I will leave that on and the gz file.

jiml8 07-30-2007 10:44 PM

OK, from that pdf, you presently have only one partition defined on that hd. That partition is defined as a linux ext2/3 partition. Have you tried to mount it?

Even if the partition boundaries are messed up (and they might be; the second partition entry is completely zeroed out), we can still probably recover the partition table correctly so long as the first partition is correctly identified.

The file system is not the same as the partition; even if the partition has been redefined to cover the whole HD, the file system is the size of the old partition. So, try running fsck on /dev/sda1 and see if the file system can be recovered. If it can, then we'll work on getting the second partition back.

What does fdisk -l or sfdisk -l have to say?

Neo-Leper 07-30-2007 10:47 PM

$ sudo sfdisk -l /dev/sda1

Warning: start=63 - this looks like a partition rather than
the entire disk. Using fdisk on it is probably meaningless.
[Use the --force option if you really want this]


Also I can mount it but there is nothing there. I ran testdisk before and I could see all the files there, and folders.


All times are GMT -5. The time now is 05:52 PM.