LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-02-2007, 05:01 PM   #1
RaduH
LQ Newbie
 
Registered: Nov 2007
Location: Colorado, USA
Posts: 11

Rep: Reputation: Disabled
Question Suse 10.2, Boot partition flipping, Grub intimate details


Hi all,

I've read quite a bit on the Internet before deciding to post the problem here and I am sure the answer must be out there already, I just didn't find it...

I have a PC with SUSE 10.2 (SLES, if it makes a difference) and I have these two partitions: /dev/sda1 mounted in / and /dev/sda2 mounted in /passive. This /passive is empty. I need to be able to make /passive bea copy of / and boot from it.

Let me explain. I make a big fat tgz of / excluding some directories such as /proc, /sys, /tmp, /var and of course /passive. I copy the tar to /passive and untar it there (or I can even store it on a different machine and then download it to /passive when I want). I create the directories I excluded above manually (and leave them empty). Then I go to /boot/grub/menu.lst and I add an entry which looks just like the first one, I just update (hd0,0) to be hd(0,1), I update root=... to go to sda2 and I update default 0 to be default 1. In /passive/fstab, I swap the mounting locations of sda1 to be /passive and sda2 to be /. I reboot the machine and it starts up just fine booting off of the formerly passive (sda2) partition. Now I have sda1 mounted in /passive.

However, I still used the menu.lst file in sda1 (which is now passive). It turns out I am using more than just this from sda1 but I just cannot figure out what else. The system always boots after I pull such a stunt.

Then I want to do a restore into sda1 (now passive). I begin with a "rm -rf *" in what is not /passive. Then I download a tgz into that directory and untar it. To eliminate issues related to host-specific configuration data (such as host name, ip addresses, mac addresses, etc, I use a tgz created off this same machine). I do the same thing to the /passive/etc/fstab (mount sda1 into / and sda2 into /passive) and then go to the menu.lst file in /passive/boot/grub and make sure I have the entires for booting sda1 and 2, and make sure the default is 0 (sda1). For all i care, it seems I can erase menu.lst from sda2 since it is never used. Until now I just did to sda2 what I had done to sda2 before. After a reset the machine doesn't boot anymore.

I am afraid I am destroying something with my rm -rf I am not restoring when untaring my tarball. The fact that menu.lst is always used off sda1 makes me think I am missing something that would allow me to treat these two partitions symmetrically. I think I don;t understand very well what grub does from the very beginning, especially after stage1 is loaded from the MBR. I read about stage1.5 and stage2, but it is not clear to me if those files are addressed as a fixed (hardcoded) block offset location on the disk (saved in MBR, for example, at install-time) and I am screwing this up by deleting and re-copying the files (they are the same location as referred by a file system path but not same physical disk location.

After this long novel, I think my conclusion is that there's something going on during the early stages of grub and system's coming up to life that I don't really understand, nor did I find the info about (lots of pages go almost there, but not quite there...).

I hope this makes some sense and someone can help me.

Thanks,
Radu
 
Old 11-02-2007, 10:35 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
the short answer is when you install grub into mbr, it must be told, and is told, where to find the rest of the booting files eg stage 2.

2) But I think what ever you are doing is not the most clever I have seen.

if you are looking for a smart way of backup have you considered partimage?

if you are testing different settings, then you are better off running a emulator such as virtualbox.
 
Old 11-03-2007, 10:07 AM   #3
RaduH
LQ Newbie
 
Registered: Nov 2007
Location: Colorado, USA
Posts: 11

Original Poster
Rep: Reputation: Disabled
You're right, it may not be the brightest idea, but it is a constraint imposed to me so I don't really have a choice, I need to make it work ...somehow That is using the tgz file as storage and not creating a bit-image of the partition (for that reason partimage may not work if it does what I suspect it does).

Thanks for the links to the tutorial and the troubleshooter. I'll read all that stuff hoping I'd find more details than I already found (which seem not to be enough). I'll also look at partimage, if not to use it now, at least for my enlightenment

Oh, one more thing: I know that info is put in the MBR, but I don't know "where" is expressed in block offset (suspect yes)or file system path (guess not) which makes the file immovable from the physical location where it was installed on the disk (unless that pointer info is also updated). Well, off to reading, looks like there's plenty for me to learn.

Thanks for your reply,
Radu
 
Old 11-03-2007, 10:25 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by RaduH View Post
Oh, one more thing: I know that info is put in the MBR, but I don't know "where" is expressed in block offset (suspect yes)or file system path (guess not) which makes the file immovable from the physical location where it was installed on the disk (unless that pointer info is also updated). Well, off to reading, looks like there's plenty for me to learn.

Thanks for your reply,
Radu
What goes in the MBR is a pointer to the partition containing /boot (This being where the kernel and the GRUB files are). If you install GRUB using "root (hd0,1)" it will always look for the 2nd partition on the first hard disk--no matter where that is on the physical disks. But you can do something that changes the bios order of the drives (eg swapping master and slave on IDE), and then GRUB will be lost.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB Error 2 & boot partition questions - can't boot Thirteenth Zodiac Ubuntu 9 08-06-2007 12:21 PM
GRUB: How to boot WinXP (NTLDR, NTDETECT.COM & BOOT.INI) from boot partition (EXT2) ? Rayen16 Linux - Software 1 05-25-2006 12:09 PM
Grub/Dual boot - Windows partition restored via dd won't boot pazzport Ubuntu 1 01-06-2006 01:29 PM
GRUB toasted, can't boot SuSE 8.2 after partition stupidity shock_ez Linux - Newbie 2 11-03-2003 09:42 AM
GRUB using /boot partition for multiple Linux/Windows boot? cpv204 Linux - Newbie 7 04-01-2003 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration