Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 559
  • Last Modified:

How to restore Ghosted image???

I've created a ghosted image of Linux running FC3. When the original installation was completed it was setup like this:

/dev/hda1   /boot      50-100MB ext3
/dev/hda2   swap      same as RAM (ex: 512MB) swap
/dev/hda3   /            8-12GB ext3
/dev/hda5   /video    Everything else xfs


When I ghosted this box I selected hda1, hda2 and hda3. I didn't realize at the time ghost was going to create a combined image I thought it would leave the partitions seperate.

So, to make a long story short after burning the image to my harddrive I can't boot my box. It appears that the MBR needs to be fixed as well as maybe the partitions. Can someone help me with this?

Thanks,

I'm willing to throw in an additional 500 points if this can be resolved relatively quickly...

0
ampapa
Asked:
ampapa
  • 21
  • 17
1 Solution
 
ampapaAuthor Commented:
This might also help this is from fdisk.

Actual

Partition             Mount             Point Size                             Format
/dev/hda1                    8-12GB                  Linux
/dev/hda2                   50-100MB                             W95 FAT16 (LBA)
/dev/hda3                    same as RAM (ex: 512MB)      Hidden W95 FAT16 (LBA)
/dev/hda5             /video             Everything else                       Linux
0
 
slow1000Commented:
Try booting the system with the installation (Fedora CD1, Rescue CD, or DVD), then rebuild the boot menu from there.  I can give you detailed steps later, but I don't have time right now to run the CD on my system.  The first time I rebuilt my boot menu, I found the process fairly intuitive, so maybe you will too.

This problem likely is because Ghost looks for the /etc/lilo.conf file and bases the boot setup on that, but Fedora uses Grub instead of Lilo, so the boot options get lost.  
0
 
ampapaAuthor Commented:
I'm logged into "Linux Rescue" but I don't see anything related to rebuilding the boot menu? I'm pretty green with Linux so I'm going to need almost a tep by step...

I've mounted the the system (chroot mnt/sysimage) if that's what it's called and it appears that all the data exists. I'm guessing the data is just the wrong places?

I have also managed to recreate the file system similar to this using fdisk:

/dev/hda1                   1-13                           100MB  ext3                        <======= should be /root
/dev/hda2                   14-75                          500MB Linux swap               <=======should be swap
/dev/hda3                   76-1448                      8-12GB ext3                         <=======should be /
/dev/hda4   /video       1449-19929                 Everything else xfs


Thanks.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
slow1000Commented:
Ok, after doing chroot /mnt/sysimage, then run

grub-install /dev/hda

If everything goes well, the grub-install should locate everything and rebuild the mbr on its own, and the problem will be fixed.  If not, post back here.
0
 
slow1000Commented:
The grub.conf file may need to be changed, but so long as the mbr rebuilds in the above step, grub should load.

If grub loads, you can manually edit the boot options to get back into your regular system.  From there, it will be easy to edit the grub.conf file
0
 
ampapaAuthor Commented:
I went through that process with no luck.

I'm doing a re-install but am confused on ultimately how I'm going to fix this. I figure if this doesn't go correctly I could always restore it andtry something else?

This is the layout I used with Disk Druid leaving my original /dev/hda4 alone since I wanted to save the data.

/dev/hda1                   1-13                           100MB  ext3                        (/boot)
/dev/hda2                   14-75                          500MB Linux swap               (swap)
/dev/hda3                  76-1448                      8-12GB ext3                         (/)

Once this is complete I was going to restore my image to /dev/hda3 and hopefulyy solve my problem?

Since when I created my image I chose to include '/dev/hda1' (/boot) and '/dev/hda2' (swap) will I need to delete those files/directories  from '/dev/hda3' that containing that information?
0
 
slow1000Commented:
If your system boots into grub, but fails to boot into linux, the following options likely will be what you will need to boot your system:

root (hd0,0)
      kernel /vmlinuz ro root=LABEL=/
      initrd /initrd

You can edit your configuration by pressing "e" within grub, then modifying to read the above, then type "b" to boot it.  Afterwards, you can edit your /boot/grub/grub.conf file.
0
 
slow1000Commented:
Sorry, I wrote the above post before seeing yours.

Yes, you should be able to restore your old system by replacing everything in /dev/hda3 with your original data.

What went wrong with the above process?  Did the grub-install return any errors?  If that went fine, it should have rewritten the mbr.

0
 
slow1000Commented:
The last part of your question is something I have never had to deal with.  I suspect your partition table could get a bit knotted if you were to try to restore everything to /dev/hda3 (You are limited to 4 primary partions on a disk).  It may be best if you restore those files to a different hard disk, then move all the files from your original /dev/hda3 to your new /dev/hda3.  You could do that from within a booted linux CD enviroment.  
0
 
ampapaAuthor Commented:
slow1000, grub seemed to work when I tried to create the MBR but on reboot the system "paniced"?

The re-install finished and I recopied the ghost image to /dev/hda3 and rebooted. The 1st thing I noticed is it's using the wrong kernel version and I get the error:

mkrootdev: label / not found
mount: error 2 mounting ext3
mount: error 2 mounting none
switchroot: mount failed: 22
unmount /initrd/dev failed: 2
Kernel panic - not syncing: Attempted to kill init!

Then it locks up.




0
 
slow1000Commented:
Did you happen to notice what the system was doing when the kernel panicked the first time (before reinstall)?  Was it just starting to enter init, or did it panic earlier?  And was the boot menu that showed up then (before reinstall) your regular grub menu?
0
 
ampapaAuthor Commented:
Like most people who get frustrated I missed the details and moved on to something else. so, no I don't know what the error message said.

Isn't there a way to modify the grub for the correct Kernel? I'massuming that's why it locked up?
0
 
slow1000Commented:
You probably now have two kernels, one located in /dev/hda1, and one located at where ever ghost put the restored /boot partition.  It shouldn't matter which kernel you boot (original or reinstall), what matters is the other options in the boot menu (either kernel needs to know where everything else is located).  If you can find out what ghost did when restoring the partitions, (by running fstab -l or something like that from a boot floppy or the fedora cd), you can change the specified options in the grub menu.

First, if you just want to try editing the grub startup option by hitting "e" at startup when the grub menu shows (assuming it does), then changing your default options to the following, the system might boot.  These are generic options that might work.

root (hd0,0)
     kernel /vmlinuz ro
     initrd /initrd
0
 
slow1000Commented:
If the above grub edit doesn't work, reboot and edit the kernel line again:

root (hd0,0)
     kernel /vmlinuz ro root=/dev/hda6
     initrd /initrd
0
 
ampapaAuthor Commented:
I get no grub menu at all?

Can I log into the sysimage and do it from in there?
0
 
ampapaAuthor Commented:
Sorry, I didn' think that last post through. I can get to the Grub menu and "e" edit.

Currently it says:

kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-1.667.img

Are you still certain about your prior suggestion?

root (hd0,0)
     kernel /vmlinuz ro
     initrd /initrd

or

root (hd0,0)
     kernel /vmlinuz ro root=/dev/hda6
     initrd /initrd


Why '/dev/hda6' shouldn't that be pointing the my restored information on '/dev/hda3'?
0
 
slow1000Commented:
I assumed that Ghost restored all three partitions, if so then /dev/hda3 might be a logical partition with the root partition at /dev/hda6 or possibly hda4 or hda5.  

Editing grub from the grub menu is not permanent, when you hit escape or reboot, the original menu is restored.  Only changes to the grub.conf file are permanent.  So go ahead and try different possibilities to see if one works.  The option you will want to change is the root=   option, everything else probably is good.  So I would try root=/dev/hda3, root=/dev/hda4, etc.  

If you have no luck, the best thing might be to delete all your partitions except for your last one (video), then restore the ghost image as you did in the first place.  It would be much easier to restore your system from that state than the state it is in now.
0
 
ampapaAuthor Commented:
I just did another restore and currently have the following partitions -

/dev/hda1                                 /boot ?
/dev/hda2                                 swap
/dev/hda3                                 / ?        
/dev/hda4   /video      

/dev/hda3 is where the restore was written.

When changing grub to /dev/hda3 I get error 15: File not found?

0
 
ampapaAuthor Commented:
Actually I get the error "I get error 15: File not found?" on all partitions...
0
 
slow1000Commented:
Grub does support file name completion using tab.  Do you have a grub menu entry on which to base commands?

If you have the most recent kernel,

      root (hd0,0)
      kernel /vmlinuz-2.6.11-1.14_FC3 ro root=LABEL=/
      initrd /initrd-2.6.11-1.14_FC3.img

should work.

Otherwise,

      root (hd0,2)
      kernel /vmlinuz-2.6.11-1.14_FC3 ro root=LABEL=/
      initrd /initrd-2.6.11-1.14_FC3.img

Might work.

You can complete the filename with tab if the partion you are working on is the correct one.  If you have an earlier kernel, the version numbers will be different (but tab will complete the filename).  

You might have to change the first possibility to root=/dev/hda?, if either option does not work.  For the first option I listed, try root=/dev/hda3.  Try root=/dev/hda1 in the second boot option I listed.

If the partitions restored successfully, and you have grub working, you will be able to boot the system.  Finding the right configuration probably will be a hassle, though, and take trial and error.
0
 
ampapaAuthor Commented:
I'm not sure I follow your suggestion? When I do TAB in GRUB I get the original kernel - kernel /vmlinuz-2.6.9-1.667.

Something else I noticed I took a look at grub.conf on one of the reboots and If I recall correctly there was an entry LABEL=/1 and LABEL=/boot1. I'm not sure if that tells you anything, just mentioning it.

I just booted back into the system using "Linux Rescue" and verified the partitions exist with a note /dev/hda3/ I think is an extended partition, it has a "+" at the end of the blocks?

                   Boot              Start                    End                   Blocks              ID             SYSTEM
/dev/hda1       *                 1                        13                       104391          83             Linux
/dev/hda2                          14                      75                       498015          82             Linux Swap          
/dev/hda3                          76                      1448                   11028622+     83             Linux                
/dev/hda4                          1449                   19929                 148448601     83             Linux  


Thanks,
0
 
ampapaAuthor Commented:
I went back to take a look at the grub.conf and now it's blank?
0
 
slow1000Commented:
Try this from within grub.

Edit each line one by one by hitting "e" then press enter after you edit each line.
They should look like this:

root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/hda3
initrd /initrd-2.6.9-1.667.img

After the lines look the above, press "b" to boot your kernel with the above options.

You can use tab in grub to get the kernel and initrd names right.
0
 
slow1000Commented:
If grub shows up as blank, you may have to create the above setup, that's more fun yet.

You might edit your grub.conf file to have the above options, then try booting your system.  Eventually, you'll have to setup your grub.conf file correctly anyway.
0
 
slow1000Commented:
If all you get when your systems starts is a prompt

grub>

then you could type in each of the lines that I just specified above, hit enter after each one, then type "boot" and hit enter.  Hopefully, your system will boot.
0
 
ampapaAuthor Commented:
I got a partial boot with:

root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/hda3
initrd /initrd-2.6.9-1.667.img

Here are some highlights -

...
Checking root filesystem /1: clean, 119173/1376256 files, ...
Remounting root filesystem...
Setting up logicalvolume mgmt
Checking filesystems
fschk.ext3: Unable to resolve 'LABEL=/boot1'                                 [FAILED]

****An error occurred during he file system check.
Give root password for maintenance
...


0
 
slow1000Commented:
It is possible that the ghost image is corrupted or didnt' copy correctly.  I'm not sure where the 'LABEL=/boot1'  reference is coming from.  Was that included in the grub settings?  

You mentioned that you saw something like it in an earlier post about your grub menu.  I wonder if it was still an option in grub, or if your partition is marked with that label incorrectly.  Perhaps there is something wrong with your /etc/fstab file that is causing this problem.

You did get the system to boot, there just is an inconsistency of some sort with the system.  Did you try entering the root password at the prompt?  If you get a shell, your system might work enough to poke around and see what's wrong.
0
 
ampapaAuthor Commented:
Do you think it has something to do with the image having a '/boot' and '/' partition when it was created? Hence the reason for the labeling 'LABEL=/boot1' after restoring it to a drive that I re-installed FC3 on creating a '/boot' and '/' directory.

Yes, I did see 'LABEL=/boot1' in the fstab file.

Where should the grub.conf file be located? In the /boot/grub/ directory? If so that doesn't exist in the /dev/hda3 partition.

After entering the "Maintenance" I'm prompted with "(Repair filesystem) 1 #"?
0
 
slow1000Commented:
The /boot partion is hda1, so if you are looking at it using system rescue, it will be located at /dev/hda1/grub (where ever /dev/hda1 is mounted).  

You probably have to edit the /etc/fstab file to read

LABEL=/boot             /boot  

instead of boot1

Or you could try

/dev/hda1                 /boot

if your system still refuses to boot fully with the above.
0
 
ampapaAuthor Commented:
I'll give both those a shot and post back in the morning. Thanks for the help slow1000.

A thought I was having which you mentioned before is to do a full re-install on this drive and restore my image to another drive then copy the data from one to the other. My problem is I need the kernel and all from the backup the only thing I don't need is the '/boot' and the '/' so how would I accomplish that?

0
 
ampapaAuthor Commented:
O.K. it seems to have worked! I made it through a complete boot using the last suggestion (/dev/hda1       /boot) and by modifying grub on the boot up "e".

I know I've installed a more recent kernel than 2.6.9-1.667 I'm sure it's 2.6.10 something...?  I think I know why it's at 2.6.9, it's because I did the re-install and that's the kernel version of the CD set I have.

Since my image contains a newer kernel 2.6.10.. how can I determine what version it is? Do I need to just change grub.conf and reboot with the newer kernel?

Thanks,
0
 
slow1000Commented:
The most recent kernel version for FC3 is vmlinuz-2.6.11-1.14_FC3.  If you have the kernel located in your /boot partition, you could just change your grub.conf to match the kernel.  You could try downloading and installing the kernel thru Red Hat Network, it should install correctly, and modify the grub.conf file also.  If you decide to do it by hand, be sure to modify both vmlinuz and initrd to match.  

It might be easiest if you create a few grub.conf entries while you are working on it for now (the one I mentioned before that worked into the grub.conf and add your updated kernel version as another entry).  You can always delete the old one if the new one works.

Here is what you probably should have for entries if you have the latest kernel and the one you were working with:

title Fedora Core (2.6.11-1.14_FC3)
      root (hd0,0)
      kernel /vmlinuz-2.6.11-1.14_FC3 ro root=/dev/hda3
      initrd /initrd-2.6.11-1.14_FC3.img
title Fedora Core (2.6.9-1.667)
      root (hd0,0)
      kernel /vmlinuz-2.6.9-1.667 ro root=/dev/hda3
      initrd /initrd-2.6.9-1.667.img
0
 
slow1000Commented:
One more note, you can find the kernel version by looking at the file names in /boot.
0
 
ampapaAuthor Commented:
So, if I had other Kernels installed there would be other folders, files, etc in the /boot directory?
0
 
slow1000Commented:
No extra folders, but you would have an extra vmlinuz, initrd, config, and system.map file for each additional kernel version.  The 2.6.9 version is only about 6 months old, so it is possible that you don't have a newer version yet.  Red Hat Network normally flags the kernel as a package to be skipped if you update that way.
0
 
ampapaAuthor Commented:
I don't see any additionl kernel information so I must have been wrong in my assumption in having a more recent version installed?

I noticed the the "volume" label for "/" is "/1" but "/boot" is "/boot"? from what I've read the "LABEL=" setting in grub is supposed to eliminate having to modify it each time you upgrade the kernel. Do you think changing the "/1" label back to "/" would be detrimental?

Thanks for all of your help. I'll post an additional 500 point question for you as a new question, I believe that is allowed?

ampapa,

0
 
slow1000Commented:
You probably only had one kernel installed, or the /boot partition is still the one from you recent install of Fedora.  If you do a lot of changes, sometimes its hard to keep track.  I don't think it really matters (unless you're on dialup and don't want to download a newer version).

I would change /1 to /.  If you do have any problems, Fedora keeps the older kernel around so long as you use the builtin up2date program to add the new kernel.  So you can always boot up with the older kernel and restore any changes if there are problems.

I'm not sure about EE rules, but I have seen a number of point questions before.  Glad to have helped.
0
 
slow1000Commented:
One note before you change the /1 label: you'll have to update /etc/fstab to reflect the volume label change.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 21
  • 17
Tackle projects and never again get stuck behind a technical roadblock.
Join Now