GRUB Error 17 and a buggered up partition table
I made the mistake of trying to resize some of my partitions yesterday. Unfortunately, gparted exited with an error, and today I've been having the interesting exercise of trying to get my system to boot properly, along with the fact that one of the partitions (the one with the contents of /opt, not an important one, and everything should work perfectly fine without it) is nowhere to be found using testdisk.
Fortunately I have backups of my important data, but I'm pretty sure it's possible to just fix this issue without having to reinstall the operating system. The partitions that I can find appear to be intact. I feel like I'm close, but don't know enough about how to use programs like fdisk and checkdisk and grub, so I'm kind of poking around in the dark and would appreciate some help. Before I buggered up the system, my ATA hard drive looked like this: Code:
I can't remember which was set as bootable, but for the sake of getting it to work again I'll just go with whatever works, and forget about what it was set as before. My /boot/grub/menu.lst was: Code:
Now after writing a new partition table using testdisk, fdisk -l says that my drive looks like: Code:
root@Microknoppix:/home/knoppix# fdisk -l sda5,sda6,sda7 and sda8 are the ones that are supposed to be logical partitions inside the extended partition. Anyway, I naively hoped that I could ignore these questions and just go ahead and change my /boot/grub/menu.lst to: Code:
title Debian GNU/Linux, kernel 2.6.26-2-686 Does anyone have any advice on this? If someone's familiar with using fdisk, testdisk or something similar then any help would be much appreciated. Let me know if there's some info I may have left out. Thanks. |
When did you get GRUB error 17 ?
When you try to start linux ? You're menu.lst stated for Debian (Hd0,2) that is sda 3 sda2 is (hd0,1) As far as I see it SDA3 w95 ext |
I would say pretty much the same thing.
hd(0,2) corresponds to sda3. Your boot partition would be hd(0,1). What is the sda3 W95 Ext'd (LBA) partition for? I have experience with fdisk and GParted ... but what exactly did you do to the hard disk between the original layout and what it ended up? The GRUB error 17 is "cannot mount the selected partition", by the way. |
Thanks guys.
I am getting grub error 17 and I now think that my menu.lst is as you suggest: Code:
## ## End Default Options ## 1) Before using gparted, I ran out of space on the / partition. So I wanted to use GParted in order to grow that partition. In order to do so, I needed to shrink /home, and then move /swap, /usr/local and /opt all to the right. This worked until getting to /opt, at which point it wasn't able to finish and instead reported an error. 2) I tried to run gparted again, but then it told me that there were no partitions on the drive. 3) I was able to boot into linux using the CTRL-D option at bootup, but for example I couldn't find list the contents of the directory ~ (I'm just going by memory). So even though gparted saw no partitions, I was able to boot into Linux, albeit a poorly working version of linux. 4) I booted into Knoppix and am now trying to use testdisk to restore the partition table. After doing this, gparted sees the partitions that I've listed as output of fdisk -l in my first post. When I use testdisk, I don't use a very advanced method, and as I say I'm kind of poking around in the dark. I just do the following. i) Call testdisk from command prompt. ii) Choose to create a new log file. iii) Select /dev/sda as the disk to look at. iv) Select partition type "Intel/PC partition" v) Then to decide what to do with the disk, select "[ Analyse ] Analyse current partition structure and search for lost partitions" vi) Then select "Quick Search: try to locate partition" vii) After doing so, it looks like this: Code:
TestDisk 6.10, Data Recovery Utility, July 2008 I say the following (see the P,D,L on the left): Code:
TestDisk 6.10, Data Recovery Utility, July 2008 I click enter to proceed, then select [Write] to write the partition structure to disk. Then I try to reboot and that's when I get grub error 17. I have no idea why I now have a W95 Ext'd (LBA) partition. Thanks for asking though. When running testdisk, I select the P and L in the column on the left in hope that it will set up an extended partition for me that contains logical partitions / , /usr/local , swap , /home since this is how it was set up when it was working (see how I describe the layout of my hard drive when it was working). All of these partitions that are supposed to exist as logical partitions are formatted as ext3fs, so I don't understand what the reference to W95 is for. The IBM partition is FAT32. Does W95 mean Windows 95 or something? I'm having a bit of a hard time finding the appropriate documentation that will tell me what all of these abbreviations are or how to proceed properly in testdisk so that I actually know that I'm setting up the partition table properly. I think I'm going to try to figure out how to do this from within fdisk since that might allow for a bit more control. If there are any suggestions on a different program to use, or a better way to proceed with one of the programs that I've already been using, or some good tutorials, then please let me know. Okay thanks again. |
Many thanks guys. I've got this fixed. I'm writing this now booted from my hard drive.
I used fdisk to write the partition table instead of just hoping that/wondering if testdisk was doing it correctly. Testdisk was indispensable in letting me to find out where the partitions were supposed to start and stop, but I didn't find it very useful for actually writing the partition table in the proper way. I used the partition table created by testdisk to tell me where to start and stop each partition, but fdisk gave me more flexibility of changing what file system type they should be and so on. I found the following howto to be helpful: http://tldp.org/HOWTO/Partition/fdis...ing.html#mixed One thing you have to watch out for is the fact that testdisk starts at 0 whereas fdisk starts at 1, so if you're not careful you can end up with off-by-one errors. But once you're in fdisk, the help menus are really nicely laid out, so if there are any issues you can refer to the help menus. I wrote the old partition table to be like it was before I used gparted, and then when that was done, I went back to the old /boot/grub/menu.lst that was there before I used gparted. The only thing now is that at bootup it tells me that /dev/sda6 is not formatted properly (that's the missing /opt which indeed is not formatted properly). So I'll just format that and I'm crossing my fingers that everything's fixed. |
I find sfdisk best for partition table backups - it creates a txt file you feed back to it to recreate the partition table.
Like all backups, no help if not done in advance of being needed. I use a USB key to ensure it is available when I need it. |
All times are GMT -5. The time now is 11:16 AM. |