LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cloned harddrive doesnt boot up / misconfigured bootloader? How to fix? (https://www.linuxquestions.org/questions/linux-newbie-8/cloned-harddrive-doesnt-boot-up-misconfigured-bootloader-how-to-fix-4175438022/)

Thambry 11-20-2012 04:55 PM

cloned harddrive doesnt boot up / misconfigured bootloader? How to fix?
 
I got a severe problem that is probably just a mis-configured/missing bootloader, but i cannot figure it out myself (I only have basic knowledge about linux myself). I need to make a copy of the bootdrive of a XUbunto 12.10 system. The current bootdrive gets more and more problems and i want to clone it all on a SDD. But when I try to boot from the SDD probably accesses it and instantly reboots again. I read about this in the internet and its the bootloader. Even in this forum is a topic about that (http://www.linuxquestions.org/questi...k-help-629356/) but i tried to adapt it to my configuration/layout but it doesnt work. So you are my last hope to successfully get my cloned SDD to boot. Here is what I tried:
Then I booted with the XUbuntu 12.10 installation CD (from a USB DVD drive) as a live CD. The SDD shows up on the desktop, so i doubleclick it to get it mounted. I do "sudo su" to get admin rights. "fdisk -l" gives me the following layout:

Disk /dev/sda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders, total 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7370ad28

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 3905535 1951744 82 Linux swap / Solaris
/dev/sda2 3905536 117231407 56662936 5 Extended
/dev/sda5 3907584 117229567 56660992 83 Linux

Here is what I tried to install GRUB by grub-install:

root@xubuntu:/mnt# mount -t ext4 /dev/sda5 /mnt
root@xubuntu:/mnt# ls /mnt
bin etc initrd.img.old media proc sbin sys var webmin-setup.out
boot home lib mnt root selinux tmp vmlinuz
dev initrd.img lost+found opt run srv usr vmlinuz.old
root@xubuntu:/mnt# chroot /mnt
root@xubuntu:/# ls
bin etc initrd.img.old media proc sbin sys var webmin-setup.out
boot home lib mnt root selinux tmp vmlinuz
dev initrd.img lost+found opt run srv usr vmlinuz.old
root@xubuntu:/# grub-install /dev/sda
/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).

Then I tried it through grub:
root@xubuntu:/ grub

then: root (hd0,0)
then: setup (hd0)
Then i get "Error 17: Cannot mount selected partition" (no matter if i have mounted sda5 before or not).

I have tried all that was suggested in above-mentioned thread and am really lost now. Can anybody of you help me to get this SDD booted up again? Thanks alot in advance.

tekhead2 11-20-2012 05:21 PM

You mentioned that you cloned the drive, how exactly did you clone it? What process did you take when you cloned it? Do you still have the original disk and is it working? Does the GRUB menu come up when you boot without the old hard drive?

TobiSGD 11-20-2012 05:36 PM

In order to successfully install Grub from within a chroot you have to make some directories available inside the chroot that are only populated in a running system. Try it this way:
Code:

mount /dev/sda5 /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt

Then proceed with installing Grub.

Thambry 11-21-2012 12:10 PM

Quote:

Originally Posted by tekhead2 (Post 4833616)
You mentioned that you cloned the drive, how exactly did you clone it? What process did you take when you cloned it? Do you still have the original disk and is it working? Does the GRUB menu come up when you boot without the old hard drive?

I used Acronis True Image 2012. Cloning windows installation works like charm but whenever I clone linux partition/installations, I run in the abovementioned problem. So I decided to finally have it solved.
Of course I still have the original boot HDD and its still running. I dont get a GRUB menu when I boot from it. So I am not sure if it is called upon ever reboot and just boots to the default partition or if it is not installed at all. But for the cloned SDD, something is missing for sure.

Thambry 11-21-2012 12:17 PM

Quote:

Originally Posted by TobiSGD (Post 4833625)
In order to successfully install Grub from within a chroot you have to make some directories available inside the chroot that are only populated in a running system. Try it this way:
Code:

mount /dev/sda5 /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt

Then proceed with installing Grub.

Thanks alot, this already brought me a step forward - i was able to install GRUB and when booting from the cloned SDD, the computer doesnt reset instantly. But unfortunately i get an error message (presumably from GRUB):
"error: no such device: de468f7b-736d-4e6c-bb9-983fce91d0ad"
I suspect that this is the ID of the cloned SDD - but why he cannot find it is unknown to me...do you have any clue?

TobiSGD 11-21-2012 03:18 PM

After installing Grub you should also rebuilt the configuration file (while chrooted to the installation like before):
Code:

sudo update-grub

Thambry 11-22-2012 12:29 PM

Quote:

Originally Posted by TobiSGD (Post 4834312)
After installing Grub you should also rebuilt the configuration file (while chrooted to the installation like before):
Code:

sudo update-grub

You're a genius! With updating GRUB, I can finally boot from the cloned SDD. But the swap didnt work anymore - but this could be rectified by putting the correct UUID in fstab.

Thanks alot for your help again - this problem with cloning harddrives running linux pestered me for some time now but how I know how to reinstall and update GRUB :) :)

TobiSGD 11-22-2012 12:32 PM

Nice that it is working for you. Please mark this thread as solved using the thread tools at the top of the thread.


All times are GMT -5. The time now is 04:22 AM.