SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am messing around with grub on SLES 11.3.
My goal is to clone a hard drive, right now i have sles 11.3 installed from dvd onto a hard drive, with /dev/sda1 as swap 1gb in size and the remainder of the disk as /dev/sda2 formatted as ext3 mounted as /.
I tar'd everything under /dev/sda2 and saved to file.
for a new hard drive i put in the system and format that similarly- if it shows up as /dev/sdb then sdb1 is formatted as 1 or 2 gb swap partition then sdb2 is remainder of the disk as ext3. I mount sdb2 to a working system an untar that image file into /dev/sdb2, thus performing most of the cloning process.
my hangup is grub and the bootloader.
i've tried doing "dd if=/dev/sda of=/root/mbr bs=446 count=1" to save the master boot record of the good working disk built from the sles install dvd,
then doing "dd if=/root/mbr of=/dev/sdb bs=446 count=1" to restore it to the cloned disk. This does not work, when booting the cloned disk I get Error No active partition.
I feel that i am fairly close, i just need to understand grub.
so, can someone explain these options and/or provide me some links on how grub works (see attached pic) ?
The default is "boot from root partition" for grub on my system, should i change that?
From what i've read, the MBR first 446 bytes is the bootloader, the next 64 is the partition table, the next 2 is some identifier. What exactly is going wrong when i try to save the mbr from a working disk and dd it to a new disk ?
thanks
yeah i know i was advised but the more i've been looking into it the more i'm not convinced.
we're talking 512 bytes worth of information, 2 of which are always 55 AA, and 64 bytes is the partition table which i should not need to touch after i've formatted a new disk. so then it's a matter of how grub works and how or what it installs in 446 worth of space and where. if anything i'd like to simply understand what's going on.
and since this thread got moved to the novell forum, is grub tailored in suse/sles and is all this specific to the operating system type? or does everything (people who run redhat, ubuntu, whatever) also have the same grub options as in my attached pic?
if i have time and a spare system i'll continue to play around with the grub options,
my next thought is since the stage1 grub file shows up as 512 in size, is that what gets installed into the MBR if i choose the option "boot from Master Boot Record"... or 446 bytes of it ?
does everything (people who run redhat, ubuntu, whatever) also have the same grub options as in my attached pic?
No, they don't. Most distributions I have used give you the option to install to the mbr, the root filesystem partition or in some cases, not install Grub at all. Opensuse has depending upon your perspective, the most detailed or convoluted bootloader installation of any system I have used. In your image above under Bootloader Settings you have Section Management as well as Bootloader Installation tabs and you also have a tab below for Bootloader Options where you can Set the Active Flag, Write generic code to mbr as well as several other options.
well let me say that the grub 0.97 in sles 11.3 is bugged.
it does not set the active flag in the partition table and fails to install the bootloader properly, unless you are doing everything the first time during a clean install.
most times i get an error saying because of partition table the bootloader cannot be installed.
this is with the default settings for sles during install which wants to have "boot from root partition" selected as shown in my pic. in the past when i've installed sles 11.1, i was able to do the clone process then for the cloned disk i would boot the sles 11.1 dvd and say automatic repair or fix bootloader and it would recognize the problem, fix it, and then everything would work.
the latest test is i did another fresh install of sles 11.3 from dvd and during the install i selected "boot from master boot record" instead. not sure if this is a fix but i've been able to get my clone process to work.
i think the biggest hangup is the active partition flag in partition table.
I've disk dumped (dd) numerous times the first 512 bytes of various disks i've been playing with and identified the 0x80 value at the 0x1CE location in the partition table when the first partition is set to swap and the second partition is the root partition. or if i set things up to use no swap and have only 1 partition on the disk then the location would be 0x1BE. and the byte value of 0x80 is the active flag, i found when i get the error no active partition reported by the bios this location is 0x00.
I know when you repartition a disk if you also tell the partitioner to also create new MSDOS partition table, you definitely wipe the active flag. but if the active flag on a used disk happens to already be set, then you only delete partition and make new ones the active flag hangs around.
so now how do you use dd to change a single byte at a given location ?
i want to throw the value 0x80 into the location 0x1Be or 0x1CE on /dev/sdb.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.