LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nuked XP, now grub won't boot (https://www.linuxquestions.org/questions/linux-newbie-8/nuked-xp-now-grub-wont-boot-532363/)

armchair rambo 02-25-2007 06:25 PM

nuked XP, now grub won't boot
 
I was prepared for this possibility.

Relevant specifics:
XP used to be on hda, 0-3
Linux swap is hda,4
Linux resides on hda,5

Used Gparted to nuke partitions 0-3, combine them, then format to ext2. So far so good.

I backed up the MBR, so I do have that, but the "dd" command didn't work. Anyhow, I do get a grub prompt.

What should I do next?

As always, thank you

AR

michaelk 02-25-2007 06:46 PM

In an nutshell an extended partition allows one to create more then 4 partitions and is basically a container for logical partitions (anything >=5). hda2 was probably the extended partition where hda5 was located. So basically you wiped out everything except swap. Since hda5 does not exist anymore grub can not find the menu.lst file which is why you only see grub prompt. Since your prepared you might as well reinstall everything then try to recover.

armchair rambo 02-25-2007 07:43 PM

grub and hda5
 
When I boot the Fedora install disk in rescue mode it locates my Fedora installation. It is possible that I described the partitions wrong.

Anyhow, I finally got DD to work and it restored my MBR. Should have worked, right? Now Gparted and the Fedora install CD can't see ANY partitions.

The rescue disk still finds my installation when it searches the drive.

When I run
dd if=/mnt/sysimage/boot/grub/MBR-backup of=hda bs=512 count=1
everything seems to go fine.

Can I used dd to make a 20GB image (of /mnt/sysimage/)while in rescue mode and then copy that image to right place on hda (which now appears to only have one 60GB unformatted partition)?

michaelk 02-25-2007 08:06 PM

In rescue mode post the output of the command:
fdisk -l /dev/hda (that is a small L)

/mnt/sysimage should be your / partition. Your 60GB partition would then be only 20GB if successfull.

armchair rambo 02-26-2007 12:09 AM

Here goes:

fdisk /dev/hda -l


Warning: ignoring extra data in partition table 7
Warning: ignoring extra data in partition table 7
Warning: ignoring extra data in partition table 7

Disk /dev/hda 60.0GB
255 heads, 63 sectors/track, 7297 cylinders
Units=cylinders of 16065 * 512 = 8225280

/dev/hda3 * 1 2677 21502971 7 HPFS/NTFS
/dev/hda4 2678 4207 37110150 f W95 Ext'd (LBA)
/dev/hda5 * 4208 4220 7297 83 Linux
/dev/hda6 * 42221 7297 24715971 8e Linux LVM
/dev/hda7 171762 221128 396527191+ 9f BSD/OS


I hope this helps. Weird that fdisk reports the above partitions but Gparted doesn't.

AR

michaelk 02-26-2007 07:07 AM

Your /boot should be hda5 and everything else (i.e. / and swap ) is in hda6. To rebuild grub to the MBR run these commands:
chroot /mnt/sysimage
grub-install /dev/hda

syg00 02-26-2007 07:30 AM

Personally I wouldn't touch a disk with a trashed partition table like that. I might try testdisk to resurrect it.
Restoring an MBR (especially the partition table) after deleting partition(s) and reformatting cannot work.

Basically I'd erase the whole thing and restore the lot.

michaelk 02-26-2007 07:55 AM

True, it would be best to start over.

armchair rambo 02-26-2007 08:01 AM

finally, closure for my Fedora partition problem
 
OK, here's what I did. Maybe it'll help some other noob if I post it, eh?

Tried the grub-install, but it didn't work because of the trashed partition table. That was good advice to not mess with it, I agree - it's not worth saving.

When I said I was prepared, of course that didn't mean I had a backup, heh! I got into Fedora rescue mode, mounted a 1GB flash drive and moved about 7GB of zip files, 1GB at a time. That rescue mode really saved my ass! I had to reboot a few times before I got it all right

As I write this I'm reinstalling Fedora, XP is gone gone gone, and now that I know enough to actually USE the 60GB in Linux, Fedora gets the whole drive. !


Here's the commands that I used, to the best of my recollection:

mount /mnt/sysimage/dev/sda1 /media
**zipped a bunch of files to /media
umount -a /mnt/sysimage/dev/sda1

When I was ready to repeat the process, Fedora kept telling me to specify a filesystem, which it didn't ask the first time. So a reboot after each 1GB was the order of the day. I also had to format the flash drive each time, which I did (fat) on an XP machine while rebooting Fedora. It is a Kingston flash drive. The hard drive is a Seagate 60GB circa 1995, ST3600something.

This was a very interesting experiment I hope to NEVER repeat. I'll be back soon as I try to set up my RAID drives! thanks

v00d00101 02-26-2007 11:02 AM

The joys of the first mistakes you will make (dont do rm -rf / either).

You could also have done something along the lines of run fedora rescue.

Code:

dd if=/dev/zero of=/dev/hda bs=512 count=1 //to wipe the boot sector
Install xp but use rescue mode console and run fixmbr.
Boot fedora rescue and run grub-install.

Then you would hopefully be back to a point where you could run XP and linux.

You confirmed xp was still there at the point you ran fdisk -l .

Quote:

fdisk /dev/hda -l


Warning: ignoring extra data in partition table 7
Warning: ignoring extra data in partition table 7
Warning: ignoring extra data in partition table 7

Disk /dev/hda 60.0GB
255 heads, 63 sectors/track, 7297 cylinders
Units=cylinders of 16065 * 512 = 8225280

/dev/hda3 * 1 2677 21502971 7 HPFS/NTFS
/dev/hda4 2678 4207 37110150 f W95 Ext'd (LBA)
/dev/hda5 * 4208 4220 7297 83 Linux
/dev/hda6 * 42221 7297 24715971 8e Linux LVM
/dev/hda7 171762 221128 396527191+ 9f BSD/OS

armchair rambo 02-26-2007 12:43 PM

it seems so obvious now
 
I was really suprised to see that NTFS partition. After 12 hours (including sleep, heh) I think I was in too much of a stupor to see what you just pointed out. I've broken/revided XP enough times to know fdisk /mbr --:)

BTW, an observation: it's worth switching from XP to linux just for the ease of backups! I have NEVER been able to restore an XP box to this state of readiness so quickly.

syg00 02-26-2007 04:13 PM

I don't believe v00d00101 suggestion will work, as (NT based) fixmbr looks for a valid partition before proceeding - must be a primary partition, must be marked bootable, and must contain ntldr. Based on some empirical test I have done, not having seen the code.

A small variation after zapping the MBR though - use fdisk to define a NTFS partition with the same start and size as above. This will work if the filesystem is undamaged.
Used to be fdisk wouldn't open a disk that didn't have the disk signature bytes so I habitually only zap 510 bytes.

wpn146 02-26-2007 05:08 PM

Quote:

Originally Posted by v00d00101
/dev/hda3 * 1 2677 21502971 7 HPFS/NTFS
/dev/hda4 2678 4207 37110150 f W95 Ext'd (LBA)
/dev/hda5 * 4208 4220 7297 83 Linux
/dev/hda6 * 42221 7297 24715971 8e Linux LVM
/dev/hda7 171762 221128 396527191+ 9f BSD/OS

It looks like your swap partition is gone too. /dev/hda6 should be type 82, not 8e.

michaelk 02-26-2007 07:26 PM

wpn146,
Except for hda7 what you see is normal. The LVM contains both / and swap partitions.

inspiron_Droid 02-26-2007 08:32 PM

You know that 60. gb is kind of under par for drive pace now a days. So I'd suggest that sense hard drive pace is $3.05 a gigabyte you could drop about 105.00 at tigerdirect and byuyy 320 gigbyte sata drive and have more than ten times the drive space you do now for 3.05 a gb.

cheap stat hard drive


All times are GMT -5. The time now is 10:41 AM.