PDA

View Full Version : [SOLVED] Difficulty booting cloned drive



grindboy
January 6th, 2011, 10:46 PM
Hi Guys,

I only seem to come to this forum with really bizarre questions these days! Anyway after partially killing my tablet pc (motion m1400) I've internalized one of the USB ports so that I can use a 16GB USB stick as my hard drive.

I've cloned my old tablet hard drive using gparted (reduced the partition copied it across then expanded it to fill the free space on the pendrive). I've then tried to rebuild GRUB 2 using this command:


sudo grub-setup -d /media/KARMIC/boot/grub /dev/sdaHere comes the catch.

When the live OS is running (from a second 16gb pendrive) the drive I want to install GRUB on is /dev/sdc when I reboot the tablet I get "no such disk." typing "ls" reveals that the drive is now called hd0 however when I try to install GRUB with hd0 as the location at the end of the above command I get told there is no such location!

Any help would be greatly appreciated.

Many Thanks

Grindboy

garvinrick4
January 6th, 2011, 10:51 PM
How does it work when using uuid number?

wkulecz
January 8th, 2011, 12:20 AM
Welcome to the dark side of UUID drive mounting. Cloning changes the UUID of the partition, otherwise it wouldn't be universally unique now would it.

You need to boot some system that can run blkid against the drive to get the UUIDs and there is the rub if installing from backups. Once you've got the UUID you can edit /etc/fstab and the grub boot config files to fix things.

Hope you've got a liveCD handy.

grindboy
January 8th, 2011, 01:59 PM
Hi Guys

Thanks for the input. I'd forgotten about UUIDs. Which files exactly do I need to edit and where do I need to edit them? (I have next to no experience with GRUB2)

Many Thanks

Grindboy

grindboy
January 10th, 2011, 07:07 PM
Sorry for bumping but this isn't solved.

I looked at grub.conf but all the uuid's were correct. I then edited the resume file which had the wrong uuid then finally fstab where swap was using the path not the UUID and I'm still getting grub rescue. Files are below

FSTAB:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=86ea81ad-ec53-424b-bfcd-dc975bf7e10a / ext4 errors=remount-ro 0 1
UUID=98dffe13-c956-4873-ac02-8e4ea7ef3ab7 none swap sw 0 0grub.cfg:


#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
set saved_entry=${prev_saved_entry}
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z ${boot_once} ]; then
saved_entry=${chosen}
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=86ea81ad-ec53-424b-bfcd-dc975bf7e10a ro quiet splash i915.modeset=1
initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
echo 'Loading Linux 2.6.32-24-generic ...'
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=86ea81ad-ec53-424b-bfcd-dc975bf7e10a ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=86ea81ad-ec53-424b-bfcd-dc975bf7e10a ro quiet splash i915.modeset=1
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=86ea81ad-ec53-424b-bfcd-dc975bf7e10a ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 86ea81ad-ec53-424b-bfcd-dc975bf7e10a
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ ${timeout} != -1 ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###and last but not least...

/etc/initramfs-tools/conf.d/resume:


RESUME=UUID=98dffe13-c956-4873-ac02-8e4ea7ef3ab7If anyone can help would they mind explaining a little bit about what was wrong as GRUB2 is completely alien to me.

psusi
January 10th, 2011, 08:29 PM
No, cloning does not change the UUID, that is why it is called a clone. Also grub isn't even reading the config file yet, so UUIDs aren't even in the picture.

At the grub rescue prompt, type set and see what the value of the root and prefix variables are. If they don't point to (hd0) then you should fix them to do so, then you should be able to run insmod normal and then just normal to switch from the rescue prompt to the full grub shell.

grindboy
February 2nd, 2011, 01:42 PM
Thanks Psusi!