[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 suseLINUX. 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 device.map 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. George -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
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 suseLINUX.
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 device.map 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.
George
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) quit 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. 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@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
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! G
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
as a general note, on grub problems, we have an excellent utility badly named updategrub (badly because an ubuntu tool uses nearly the same name when not as good) http://forums.opensuse.org/forums/english/other-forums/development/programmi... the author is the forum power user please_try_again jdd -- http://www.dodin.net http://pizzanetti.fr -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tuesday, October 25, 2011 10:41:49 AM George Olson wrote: ..
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.
mv /home/home/george /home/george check is it all ok and if yes: rm /home/home -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/29/2011 10:02 PM, Rajko M. wrote:
On Tuesday, October 25, 2011 10:41:49 AM George Olson wrote: ..
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.
mv /home/home/george /home/george
check is it all ok and if yes:
rm /home/home
Ah, thank you. I knew it would be simple and easy! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2011-10-25 at 23:41 +0800, George Olson wrote:
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.
mc - -- Cheers, Carlos E. R. (from 11.4 x86_64 "Celadon" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAk6tT+4ACgkQtTMYHG2NR9WOFQCdHeJN6Hgy2Yn6uq4DP0mMd2pq n34An31BmaJZuSyziVMTTEc9D9PWDnE8 =fRuN -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (6)
-
Carlos E. R.
-
dwgallien
-
George Olson
-
George OLson
-
jdd
-
Rajko M.