LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2007, 06:25 PM   #1
armchair rambo
Member
 
Registered: Aug 2006
Location: minneapolis
Distribution: Fedora
Posts: 32

Rep: Reputation: 0
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
 
Old 02-25-2007, 06:46 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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.

Last edited by michaelk; 02-25-2007 at 06:47 PM.
 
Old 02-25-2007, 07:43 PM   #3
armchair rambo
Member
 
Registered: Aug 2006
Location: minneapolis
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 0
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)?
 
Old 02-25-2007, 08:06 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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.
 
Old 02-26-2007, 12:09 AM   #5
armchair rambo
Member
 
Registered: Aug 2006
Location: minneapolis
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 0
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

Last edited by armchair rambo; 02-26-2007 at 05:38 AM.
 
Old 02-26-2007, 07:07 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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
 
Old 02-26-2007, 07:30 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 02-26-2007, 07:55 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
True, it would be best to start over.
 
Old 02-26-2007, 08:01 AM   #9
armchair rambo
Member
 
Registered: Aug 2006
Location: minneapolis
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 0
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

Last edited by armchair rambo; 02-26-2007 at 08:13 AM.
 
Old 02-26-2007, 11:02 AM   #10
v00d00101
Member
 
Registered: Jun 2003
Location: UK
Distribution: Devuan Beowulf
Posts: 514
Blog Entries: 1

Rep: Reputation: 37
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
 
Old 02-26-2007, 12:43 PM   #11
armchair rambo
Member
 
Registered: Aug 2006
Location: minneapolis
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 0
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.
 
Old 02-26-2007, 04:13 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 02-26-2007, 05:08 PM   #13
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
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.
 
Old 02-26-2007, 07:26 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
wpn146,
Except for hda7 what you see is normal. The LVM contains both / and swap partitions.
 
Old 02-26-2007, 08:32 PM   #15
inspiron_Droid
Member
 
Registered: Dec 2006
Distribution: Debian (Wheeze)
Posts: 391

Rep: Reputation: Disabled
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

Last edited by inspiron_Droid; 02-26-2007 at 08:33 PM.
 
  


Reply

Tags
alsa, audio, fdisk, fedora, grub, lame, partition, sound, table, xp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gentoo : grub: The file /boot/boot/grub/stage1 not read correctly Boudewijn Linux - Software 3 05-21-2008 03:13 AM
I nuked my /boot partition and I'd like it back please Tiggs Linux - Software 11 02-25-2006 05:39 PM
need to access /boot/grub/menu.lst and /boot/grub/device.map neouto Linux - Newbie 8 09-04-2005 11:45 AM
Upgrading to 2.6.6 seems to have nuked my machine HawkeyeCoug Mandriva 4 05-18-2004 01:46 PM
I just nuked /etc cpeppler Linux - Software 28 03-18-2004 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration