Mailinglist Archive: opensuse (714 mails)

< Previous Next >
Re: [opensuse] installing GRUB on adjusted clone
On 10/25/2011 01:31 AM, dwgallien wrote:

Re the MBR, you're right, you will not have captured the boot code.
If when you installed openSUSE you put grub in the MBR, you have to
reinstall grub anyway because the new disk layout is different. If
you left the Vista code in the MBR, that could easily be copied to
the new disk (or YaST can install this same code or it can be done
from a terminal) because all that code does is read the partition
table for the active primary and transfers control to the boot sector
in that partition; for this reason, XP or even DOS MBR code will boot
Vista (except if BitLocker is enabled).

But your starting point needs to be dealing with the Windows boot
sector. You can easily verify if the Vista boot sector was cloned,
from your running openSUSE. Just attach the second drive however you
did for the clone/copying, boot openSUSE, open a terminal, switch to
root, and do:

# dd if=/dev/sdb1 of=sdb1pbr bs=512 count=1 # xxd sdb1pbr

I did this, and it turned out the MBR was copied over as you described.

Since you have a laptop, I suspect you may not have cloned/copied by
attaching the second disk. If so, you can install the second disk in
the laptop and boot the machine from a LiveCD or LiveDVD or the
Rescue shell on the openSUSE installation DVD (I don't remember if
Rescue is still on the DVD), and do it from there (except that the
disk will now be sda rather than sdb, so the syntax would need to be
changed accordingly).

That will make a copy of the new disk's first partition boot sector
and then display the contents in hex. Near the end of the sector
you'll see "BOOTMGR is missing". (BOOTMGR is the name of the Vista
boot manager program that the boot sector code calls.) If you see
this text, the sector was cloned. If you don't, you'll still see
some data at the front of the sector (specifically, "NTFS"), but the
end of the sector will be empty.

Yes, it had that code, so the MBR was copied over. Cool. Thanks for showing me how to do that.

If the Vista boot sector was not
cloned, you will need to reinstall it with the Vista Recovery Disk.
You probably don't have this, as MS only provides it with retail
media and laptop manufacturers typically don't provide it (they
instead provide a method to re-image the disk). But you can download
the Recovery iso from Neosmart's website. Burn that image, boot from
the media, and use the "automated" boot recovery; that will re-write
the Vista boot sector as well as write generic Windows boot code to
the MBR. Note again though that even if you find that the partition
boot sector was cloned, you may still need to reinstall it.

To install grub, as I indicated above, there are several methods
possible. When you installed openSUSE you probably elected to
install grub to the MBR. To do the same now for the new disk, and if
you can attach the second disk, then just open a terminal, switch to
root, and do:

# grub root (hd1,5) setup (hd1) (hd1,5) quit

I tried this when I had the 2nd drive attached by USB, which is how I copied the data over to it, and grub would not recognize the new drive. I don't know why, so I just went ahead and took the old disk out and installed the new disk in place of the old disk. Then when I ran the grub install using hd0 instead of 1, it ran fine and installed grub.

If you cannot attach the second disk, again instead boot from Live
media or Rescue, get into a shell, and do the same except use hd0
instead of hd1. Reboot from the hard disk. Your menu.lst should not
need to be changed; it will still have a chainloader stanza
referencing hd0,0 to call the Vista boot sector.

I did end up having to modify menu.lst because it identified the disk it was looking to by-id and the serial number. Since I had labeled all the partitions on the new drive, I changed the lines that said "by-id" to "by-label" and was able to get the disk to install that way.

I also had to do the same thing in the /etc/fstab file on the new disk, as those were also reference to look 'by-id' and I changed that to 'by-label'.

I had a few other problems getting the new disk to run. First, on my rsync of root, I forgot to create the /sys, /proc, and /home directories and set their permissions. So I did that afterwords.

Then I had a problem with the rsync of my home partition. On rsync, I had forgotten to use the / after "home" in the source position, so it copied the entire contents of home as /home/home/george instead of /home/george. This of course caused a problem when I tried to load KDE, as it wouldn't load.

I went back to rsync the drive with the right structure so that it would come out /home/george, and it took a long time. I was thinking, "I bet there is a way to somehow just move everything in that tree up one directory and eliminate the extra home." But I don't know how to do that, so I just did rsync again. It is brute force and it works, but it took a long time.

If anyone has any suggestions on how to do that better in case I run into it again, I would be interested to know.

So I have the cloned drive all up and running in place of the old one now, and it works fine. I have been able to boot up in windows and linux and all is running well. Thanks for the help!


To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >