Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
justsimran,
No need to apologize. My linux knowledge is pretty basic so I appreciate all the help I can get.
As far as waiting--its stable, its linux--unless I do something else stupid to crash the system I'll gladly wait days for a clean, sure way of fixing the MBR before rebooting this machine.
Good point on the patch. I better download it now while I got network access.
As a reminder, syg00, a member with almost 2700 posts, has already given you good advice. Running around in a circle, panicking and trying to get a consensus of advice from other new Linux users isn't likely to get you a better, more reliable solution.
Your partition table is lost. It's a nuisance, but if your data was on /dev/hda1, then this is little more than a nuisance. All is NOT lost if you can't get your MBR restored. All you need is to boot from a liveCD to be able to carry on. The important thing is that you do nothing to make the situation worse. IOW, do not do anything that affects any sector other than sector 0. Reread syg00's post, look up testdisk on the net and get an understanding of what it does. Don't assume that just because you develop a rapport with other users that their advice is better than someone else's.
I certainly appreciate everyone who has given me advice, though with my limited knowledge the testdisk utility presently seems to be getting me closer to my goal. So for now, back to my questions in post #8.
Letting testdisk analyze the partition structure I get:
Two concerns with this screen. 1. The NTFS is set as boot (*). I assume I need to switch this to primary and make the linux primary the boot partition? (btw. I know how to do it, but am unsure if i should). 2. There is also a large FAT32 shared between OS's. This doesnt show up on this screen, but when I press continue it is on the next screen as the extended:
Code:
Disk /dev/hda - 320 GB / 298 GiB - CHS 38913 255 63
Partition Start End Size in sectors
1 * HPFS - NTFS 0 1 1 7831 254 63 125821017
2 P Linux 7832 0 1 7863 254 63 514080 [/boot]
3 E extended LBA 31046 0 1 38911 254 63 126367290
5 L Linux 31046 1 1 31077 254 63 514017 [/boot]
6 L Linux LVM 31078 1 1 38911 254 63 125853147
[ Quit ] [Search! ] [ Write ] [Extd Part]
Return to main menu
If I select [Extd Part] its size appears to be what I remember it as. However, after reading the testdisk documentation I'm still not sure why it doesn't show up as a FAT32. Do I need to edit this?
Now for an update. On the last screen I pressed [Search!] to do a more thorough examination. Result:
Code:
Disk /dev/hda - 320 GB / 298 GiB - CHS 38913 255 63
Partition Start End Size in sectors
D HPFS - NTFS 0 1 1 6526 254 63 104856192
D HPFS - NTFS 0 1 1 7831 254 63 125821017
D Linux 7832 0 1 7863 254 63 514080 [/boot]
D FAT32 LBA 7832 1 1 31045 254 63 372932847
L Linux 31046 1 1 31077 254 63 514017 [/boot]
L Linux LVM 31078 1 1 38911 254 63 125853147
Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
Enter: to continue
NTFS, 64 GB / 59 GiB
file list for first partition unreadable. Second seems correct. 3rd (linux) damaged--probably from previous install. 4th (Fat32) correct file listing of my shared drive. 5th (linux) file list good. 6th--no option to list files. So, I'm still somewhat unsure how to proceed. Seems like I should load backup of the 2nd NTFs and of the 4th (Fat32). As it is If i press continue without loading backups I get:
Code:
Disk /dev/hda - 320 GB / 298 GiB - CHS 38913 255 63
Partition Start End Size in sectors
1 E extended LBA 31046 0 1 38911 254 63 126367290
5 L Linux 31046 1 1 31077 254 63 514017 [/boot]
6 L Linux LVM 31078 1 1 38911 254 63 125853147
[ Quit ] [ Write ] [Extd Part]
Write partition structure to disk
which definitely isn't correct.
Once the partition table is correct, with /boot set as * bootable I plan on writing the partition table and then using grub to write the MBR.
As a reminder, syg00, a member with almost 2700 posts, has already given you good advice. Running around in a circle, panicking and trying to get a consensus of advice from other new Linux users isn't likely to get you a better, more reliable solution.
Your partition table is lost. It's a nuisance, but if your data was on /dev/hda1, then this is little more than a nuisance. All is NOT lost if you can't get your MBR restored. All you need is to boot from a liveCD to be able to carry on. The important thing is that you do nothing to make the situation worse. IOW, do not do anything that affects any sector other than sector 0. Reread syg00's post, look up testdisk on the net and get an understanding of what it does. Don't assume that just because you develop a rapport with other users that their advice is better than someone else's.
Hello Quakeboy
I appriciate your advice you have given,, but if you have forgotten this forum is there to help people using linux and having problems in it,,instead of saying about "NEW USERS",, i guess everyone always make a new start in this forum
If someone has 2500 posts that means he is in this forum for quite a long time,, i want you to please double check your words (the words on net)
Allright. I decided to move forward and wrote the partition table with testdisk, changing the linux (primary, not logical) partition to the active partition.
Although I still haven't rebooted, i ran fdisk and get the following partition table:
Code:
Command (m for help): p
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 7832 62910508+ 7 HPFS/NTFS
/dev/hda2 * 7833 7864 257040 83 Linux
/dev/hda3 7865 38913 249401092+ f W95 Ext'd (LBA)
/dev/hda5 31047 31078 257008+ 83 Linux
/dev/hda6 31079 38912 62926573+ 8e Linux LVM
while the partition numbering is different than what /proc/partitions was previously (see post #8), the content seems the same.
Now, trying to setup up grub and rewrite the MBR I do:
Code:
grub> root (hd0,1)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type
grub> find /boot/grub/stage1
Error 15: File not found
however, I can see /boot/grub/stage1 from a file browser (though it is not a "english" textfile when i open it).
So, how do I point grub to this file or otherwise correctly rewrite the MBR?
Allright. I decided to move forward and wrote the partition table with testdisk, changing the linux (primary, not logical) partition to the active partition.
Although I still haven't rebooted, i ran fdisk and get the following partition table:
Code:
Command (m for help): p
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 7832 62910508+ 7 HPFS/NTFS
/dev/hda2 * 7833 7864 257040 83 Linux
/dev/hda3 7865 38913 249401092+ f W95 Ext'd (LBA)
/dev/hda5 31047 31078 257008+ 83 Linux
/dev/hda6 31079 38912 62926573+ 8e Linux LVM
while the partition numbering is different than what /proc/partitions was previously (see post #8), the content seems the same.
Now, trying to setup up grub and rewrite the MBR I do:
Code:
grub> root (hd0,1)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type
grub> find /boot/grub/stage1
Error 15: File not found
however, I can see /boot/grub/stage1 from a file browser (though it is not a "english" textfile when i open it).
So, how do I point grub to this file or otherwise correctly rewrite the MBR?
choosing root(hd0,1) was based off fdisk's showing hda2 as the active partition. However, good point on ommiting /boot/ from the find command. This found it on hda5 (the linux logical partition). Install now seems atleast partially successfull:
Code:
grub> find /grub/stage1
(hd0,4)
grub> root (hd0,4)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,4)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "embed /grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "install /grub/stage1 (hd0,4) /grub/stage2 p /grub/grub.conf "... succ
eeded
Done.
Two things: Do I need to worry about the non-fatal errors? Do I need to switch hda5 to the active partition using testdisk(not actually sure if this is possible since it is a logical partition)?
If No to both of the above--I'm I good to go on rebooting the system?
choosing root(hd0,1) was based off fdisk's showing hda2 as the active partition. However, good point on ommiting /boot/ from the find command. This found it on hda5 (the linux logical partition). Install now seems atleast partially successfull:
Code:
grub> find /grub/stage1
(hd0,4)
grub> root (hd0,4)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,4)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "embed /grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "install /grub/stage1 (hd0,4) /grub/stage2 p /grub/grub.conf "... succ
eeded
Done.
Two things: Do I need to worry about the non-fatal errors? Do I need to switch hda5 to the active partition using testdisk(not actually sure if this is possible since it is a logical partition)?
If No to both of the above--I'm I good to go on rebooting the system?
Thanks for getting back so fast.
D
I ran the same command ,, can u do one thing for me again!!
do like this
root (hd0,4)
setup (hd0) (no 4)
and can u shw me the screen again,,
i ran the same command on my machine thts why
I'm getting a little lost in what you're trying to do here. The bootable flag should be set on your Windows system partition. The Linux boot partition should not be set bootable. Only one partition on a drive should be set bootable according to the DOS boot specification. Linux does not require it, only Windows.
As Quakeboy02 says, reinstalling grub is not too important at this point. Have you tried these commands?
If grub is not correctly installed you'll still be able to boot using another method. Making sure the partition table is fixed is the important thing. It's worth making a grub floppy, if you have a floppy drive, which can help you in future situations like these.
I'm getting a little lost in what you're trying to do here. The bootable flag should be set on your Windows system partition. The Linux boot partition should not be set bootable. Only one partition on a drive should be set bootable according to the DOS boot specification. Linux does not require it, only Windows.
As Quakeboy02 says, reinstalling grub is not too important at this point. Have you tried these commands?
If grub is not correctly installed you'll still be able to boot using another method. Making sure the partition table is fixed is the important thing. It's worth making a grub floppy, if you have a floppy drive, which can help you in future situations like these.
well sometimes grub-install do not work,, its always gud to use setup(hd0) so tht it recoganises it
well it happened to me today when i was installing grub ,, grub-install didnt work
so the other option was to use setup (hd0),, no harm using it
he can use grub-install later on,, using rescue disk,,
To find your system and boot partitions, given that you can't sort it out from the information you have, you might just want to take the time to mount each partition (even if it is already mounted) then browse into it and see what is there.
To do this, create a directory tstmnt someplace convenient, then as root issue the mount command something like this:
mount /dev/hda2 tstmnt
Then just cd into tstmnt and see what is there. If this isn't it, just cd out, unmount it, and try again on the next partition.
So I was hoping everything was good to reboot, but running grub recheck as Gethyn suggested tells me /boot/grub/stage1 not read correctly. Trying to install grub using the grub-install method gives me the same error. A little web searching shows this is usually that grub.conf is pointing to the wrong location, however, I don't even have grub.conf in /boot/grub.
Jiml8, I tried to test mount the devices, but I think it is still using my old partition table since I haven't yet rebooted. Specifically,
Code:
[root@link driedlin]# mount -t ext2 /dev/hda5 tstmnt
mount: /dev/hda5 already mounted or tstmnt busy
mount: according to mtab, /dev/hda5 is mounted on /share
/share was the name of my old FAT32 partition shared between OS's.
So, maybe all I need to do is reboot? Just a little nervous as i won't have an internet from the live CD.
So, should I go for it? Of course I'm certainly not going to blame anyone if I have to go to a school computer to get more help.
I hope you took those backups.
That partition table you wrote doesn't appear to correspond to the /proc/partitions you posted earlier.
I'm guessing that it should look something like
Code:
/dev/hda1 * 1 7832 62910508+ 7 HPFS/NTFS
/dev/hda2 7833 38913 249401092+ f W95 Ext'd (LBA)
/dev/hda5 7833 31046 186466423+ b W95 FAT32
/dev/hda6 31047 31078 257008+ 83 Linux
/dev/hda7 31079 38912 62926573+ 8e Linux LVM
(the fat32 might be 'c' instead of 'b').
The important thing is the cylinder addresses - the sector count can vary (a few) depending on alignment (hence the + sign) - you don't enter those.
Writing the partition table wrongly is, of itself, no big deal - you can always re-write it to correct it. Updating data in one of the "bad" partitions is a no-no.
Fortunately it sounds like you failed on the first update to the primary Linux (which shouldn't be there).
I'd say you could probably boot, but there will be issues.
Personally I'd try my version of the partition table - but I'm not doing the updates, you have to make that call.
And of course, I always have (at least) *2* good backups of everything before I screw around with partition tables.
All of us are here just trying to help each other.
Post count is no indicator of the merit of the poster - accept anything offered, but decide for yourself what is useful, and what may not be.
Edit: Partition numbers were wrong.
Also noticed our posts crossed in flight - more to come.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.