problem with linux image restore

Discussion in 'Acronis True Image Product Line' started by wilcofong, Sep 6, 2007.

Thread Status:
Not open for further replies.
  1. wilcofong

    wilcofong Registered Member

    Joined:
    Sep 6, 2007
    Posts:
    2
    Hi,

    I have server image of CentOS 5 and migrating to new hdd. It is the same server hardware. I create image before I upgrade to bigger drive. I restore back to bigger hdd with adjusting partition sizes to fit bigger partition. Restore finished successfully. But there is BIG But, the linux stuck at boot prompt with GRUB words and no more proceed.
    I tried with rescue mode and mount the partitions. I can see all the files and partition. I try to restore the mbr with grub-install and still out of luck and stuck at GRUB prompt. I don't get GRUB GUI. just GRUB character and stuck.
    I would appreciate any suggestion to proceed.

    Thanks
    Wilco
     
  2. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,482
    Location:
    California
    I've had this happen before with Ubuntu. When I restored a Linux partition with GRUB on it, it "broke" the GRUB link and GRUB wouldn't boot. (Kind of like Vista needing a repair when the partition changes.)

    You'll need to boot from your Live-linux CD/DVD (or Knoppix) and repair/reinstall GRUB to fix it.

    I've found the easiest solution to avoid this is to install GRUB (/boot mount) to its own small partition. That way I can restore the actual Linux partition without disrupting the GRUB boot files. (Of course, if you restore the /boot partition, then you'll have to repair it again.) This doesn't really help in your case since you're restoring to a different drive. A repair would be normally be needed in this case (at least from my experience).
     
  3. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    MC: You beat me to the "Reply" button! I was going to post this.

    Wilco:

    You just need to get GRUB straightened out and then you should be OK.

    Boot your machine with a Live Linux CD (Knoppix/Ubuntu/or your favorite distro). From a root console, enter:
    Code:
    grub
    to get to a grub command prompt. Then confirm that your /boot/grub directory was successfully copied during the restore operation:
    Code:
    find /boot/grub/stage1
    This command should return the disk and partition number where your GRUB files are located; for example (hd0,0). The command may also return the location of these files on the Live Linux CD, so determine which location refers to your hard disk. Assuming that the location is (hd0,0) then proceed with the install by first setting the pointer to this partition and installing as follows:
    Code:
    root (hd0,0)
    setup (hd0)
    Substitute the correct disk and partition number if yours are different. This will install GRUB to the master boot record of the drive. If you then reboot the PC it should start up into the GRUB menu as before.
     
  4. wilcofong

    wilcofong Registered Member

    Joined:
    Sep 6, 2007
    Posts:
    2
    Thanks k0lo for your detail explaination.
    Following is what i did
    I boot up from CentOS 5 CD
    At the boot prompt: linux rescue <enter>
    and boot with rescue mode
    and at the root prompt, I run the following command
    #chroot /mnt/sysimage <enter>
    #grub-install /dev/cciss/c0d0 <enter>

    and I reboot and end up having the same problem. Bty mine is not desktop, it is sever (hp dl 360 G4).

    Following is the content of grub.conf
    I can see all the files and partitions. please give me some more expert guide.

    Thanks
    Wilco
     
  5. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,482
    Location:
    California
    For what it's worth, I never had any success installing GRUB this way.

    I always had to use the steps outlined in K0lo's post to install or repair GRUB.
     
  6. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    Wilco:

    It looks like you're trying to install GRUB to a folder on a partition. I believe that you instead want to install it to the master boot record of the drive.

    Instead of this:
    Try this:
    Code:
    #chroot /mnt/sysimage <enter>
    #grub-install [B](hd0)[/B] <enter>
    From looking at your grub.conf file, the kernel image is on (hd0,0), which is the first hard disk, first partition, so I believe that you want grub stage 0 files to be on the first hard disk in the master boot record (hd0). Sound correct to anyone else?
     
  7. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,482
    Location:
    California
    Mark,

    That's what I would say also.

    Here are some more detailed instructions (from the Ubuntu forum) on installing GRUB. I have removed the "sudo" command since you're using a root console:

    -------------------------------------------------------------------------

    I am going to give you the commands and then I will explain them later.

    When you get to the desktop open a terminal and enter:

    Code:
    grub
    This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands

    Code:
    find /boot/grub/stage1
    This will return a location. If you have more than one, select the installation that you want to provide the grub files.

    Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands).

    Code:
    root (hd?,?)
    Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

    Next enter the command to install grub to the mbr

    Code:
    setup (hd0)
    Finally exit the grub shell

    Code:
    quit
    That is it. Grub will be installed to the mbr. When you reboot, you will have the grub menu at startup.

    Now the explanation.
    grub gets you the grub shell.
    find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
    So root (hd?,?) tells grub it's files are on that partition.
    Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
    Quit will exit you from the grub shell.
     
Thread Status:
Not open for further replies.