Mailinglist Archive: opensuse (882 mails)

< Previous Next >
Re: [opensuse] booting from a duplicated hard disk
  • From: Istvan Gabor <suseuser04@xxxxxxx>
  • Date: Thu, 30 Dec 2010 19:18:21 +0100
  • Message-id: <4fafc33f.1ae487fb.4d1ccced.de96b@xxxxxxx>
2010. december 30. 18:06 napon Sampsa Riikonen <sampsa.riikonen@xxxxxx> írta:

Dear List,

I have duplicated my hard disk using "dd", including the boot partition to
another hard disk (a sata drive in a usb box). Now I am trying to boot from
this duplicated disk, but nothing happens.. grub does not start at all.

I googled around and found these two posts:

http://www.idlecool.net/how-to-clone-the-linux-root-file-system-and-set-up-boot-loader/
http://stackoverflow.com/questions/247030/

Based on those, I tried the following:

1) My current (original) root partition is "/dev/sda4" (mounted at "/")

2) The root partition at the (duplicated) usb drive is "/dev/sdb4",
mounted at "/media/disk-17"

3) I login as the root and give the commands

mount --bind /dev /media/disk-17/dev
mount --bind /proc /media/disk-17/proc

4) Then I give the command

chroot /media/disk-17

If I have understood correctly, now "/" will be "/media/disk-17" = "/dev/sdb4"
But the system sees "/" as "/dev/sda4"

Next I type:

grub-install /dev/sda

And get the following output:

--------------------------------
Probing devices to guess BIOS drives. This may take a long time.


GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> setup --stage2=/boot/grub/stage2 --force-lba (hd0,3) (hd0,3)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,3)"... failed (this is not
fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,3)"... failed (this is not
fatal)
Running "install --force-lba --stage2=/boot/grub/stage2 /boot/grub/stage1
(hd0,3) /boot/grub/stage2 p /boot/grub/menu.lst "... failed

Error 15: File not found
grub> quit
------------------------------------------

What might be the problem here..?

Regards,

Sampsa


Hello:

Earlier I also cloned hard disks and also had problems with booting the
clones. I don't see what can be the problem in your case but it still
may help how I made it finally:

1. Use a live system like knoppix os similar for cloning the image.

2. After the cloning boot your original OS (not the cloned one),
mount the cloned partition somewhere and edit the files on it:
/boot/grub/menu.lst, /etc/fstab (on the cloned
partition!)
I found easier to manage hard disk partitions by their device IDs.
You can find it out by
$ ls -l /dev/disk/by-id
I replaced the hard disk partition names (eg /dev/hda, sda) by device
ID names.

3. You also might have to make a new initrd image, as boot partitions
are hard coded in it.
see:
http://lists.opensuse.org/opensuse/2010-01/msg00588.html

extract from the above message:

mount /target_partition.
mount --bind /proc /target_partition/proc
mount --bind /sys /target_partition/sys
mount --bind /dev /target_partition/dev
chroot /target_partition

(Those directories (proc, sys, dev) in the target should be
empty before the binding.)

Run mkinitrd.

4. Probably you have to install grub again onto the newly
cloned root partiton, I guess still in the chroot-ed enviroment:

# grub
root (hd0,0)
setup --force-lba (hd0,0) (hd0,0)
quit

Assumed you don't have a separate /boot partiton.

Maybe this helps.

Cheers,

Istvan

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References