Mailinglist Archive: opensuse (714 mails)

< Previous Next >
Re: [opensuse] installing GRUB on adjusted clone
I have a dual boot laptop, with windows vista as originally installed,
and openSUSE 11.4 running. I normally run openSUSE and only go back to
vista for a particular thing here or there.

I had my vista running in 2 primary partitions, with the first partition
being the vista boot partition, and the 2nd partition being a data
partition. When I installed openSUSE, I first shrank the data partition.
After shrinking the 2nd partition, for the rest of the disk I made an
extended partition, like so:
sda1 - 39gb - windows c
sda2 - 92gb - windows d (data)
sda3 - extended partition
sda5 - 2gb - swap partition
sda6 - 20gb - root partition
sda7 - 20gb - not mounted - for later install of the next distribution
and testing
sda8 - 292gb - home partition

After using this for some time, I decided I really don't need 92gb for
my windows partition, and I would really like to take about 20gb of that
and move it to the end of sda8. Of course, I don't know how to do that
on an active partition, so instead I purchased another hard drive.

I have formatted my 2nd hard drive basically the same as the active hard
drive, except that on the new drive my sdb2 is only 72gb and my sdb8 is
312gb. I used a windows cloning tool to copy my windows c and d drives
to the new drive, and I used rsync to copy my root and home partitions
over. I gave the root and home partitions in the new drive the labels
rootb and homeb.

So, now I have the new drive set up and I want to put it in my laptop
and run off of it instead of my old drive (which I will eventually use
as a clone backup).

The challenge for me now is to setup grub and the new /etc/fstab file so
that I can do just like I did before - have dual boot with windows and

I am a bit confused, however, on what I need to do with the MBR. This
drive was fresh out of the box, and the first thing I did with it was
setup the partitions using kparted in yast. The next thing I did was use
Casper in Windows (Vista) to clone the C and D drives. Then I mounted
the rootb and homeb partitions in Suse and used rsync to copy my data over.

I have read through the Novell cool solutions on configuring dual boot
by booting from the dvd in a rescue shell. It talks about making changes
to the menu.lst file (which I can do) and the file, which I
can also do. The last step says to run the command

grub-install --root-directory=/mnt/ /dev/hda

which will install grub in /mnt/ (which is where the previous step has
instructed you to mount the root directory of the drive you are
installing it on).

The problem is, this procedure was written for having just installed
Windows on a SUSE linux machine, which overwrites the MBR. In my case, I
have never actually installed windows on this drive - I just cloned the
data of the key partitions, and since I cloned partition to partition, I
am pretty sure the cloning tool didn't do anything with the MBR.

So what should I do? should I go ahead and just run the grub-install
command? Doesn't windows need to see something in the MBR that looks
like its own code or something in order to work properly? or will that
not matter when I install grub?

I appreciate any advice you all can give. Sorry for being so verbose.


First, the information you got from the Cool Solutions is probably out of date.
The grub-install script will simply use /etc/grub.conf (which is maintained by
YaST) as batch input; it is not the same script as the old grub package's
grub-install (which in openSUSE is now named grub-install.unsupported). Of
course you can manually edit grub.conf to have the grub shell command as shown
and then run grub-install, or you can just do it directly from the grub shell
(which is what the script calls). However, there is much more for you to
consider . . .

You don't say explicitly what your boot setup was on the original drive. When
installing openSUSE, you may have installed grub to the MBR - or not. You
could have installed grub to the sda3 partition boot sector, marked it "active"
(aka "bootable"), and the Windows boot code in the MBR would have called grub.
Or you could have installed grub to the sda6 partition boot sector and used the
Vista boot manager to "chainload" to grub there. The openSUSE installer
supports all these methods.

Re your cloning: If Casper is in fact a true cloning tool, it should bit copy
the entire contents of a partition, including its boot sector(s). This is
critical because to boot Windows, regardless of whether Windows code or grub
code is in the MBR, it will be the first partition's boot sector that gets
called. Theoretically the cloned boot sector will work. But given the
complexities, that's not at all guaranteed. The NTFS boot sector includes an
animal called the "extended boot sector" which is actually sectors 2-16. MS
"reserves" this data structure for various uses aside from the boot process,
some of which are not well documented. Sometimes a cloned boot sector does not
work and so it must be reinstalled.

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

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. 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)

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

If you did not or do not want to install grub to the MBR, Windows generic code
can be installed instead with grub installed to the extended primary
partition's boot sector. Let me know if you need those instructions.

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

< Previous Next >
Follow Ups