LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-27-2006, 01:48 PM   #1
tntcoder
Member
 
Registered: Sep 2003
Distribution: Arch
Posts: 89

Rep: Reputation: 15
Backing up/restoring LILO


Hi,

I have lilo installed on the mbr of my hard drive, i need to install win xp as a dual boot on the same hard drive, when i install XP am i correct in assuming it will overwrite the MBR with its own bootloader?

So what i need to do is backup LILO/MBR and be able to restore it after XP is installed,

Is there any easy way to do this?

Thanks
Jack
 
Old 05-27-2006, 03:23 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
dd if=/dev/hda of=/path/to/backup bs=512 count=1

The MBR is just the first sector (512 bytes) of the hard drive. I'd back it up onto a floppy. Be careful with this -- if you get the if and of backwards, you'll nuke your MBR! An easier thing to do would be to install LILO itself onto a floppy and verify you can boot your Linux distro with it. Then go ahead, reinstall XP (it will indeed overwrite in the MBR). Then boot off of your boot floppy to get back into Linux and rerun the lilo command to reinstall LILO on the MBR (don't forget to add an entry to /etc/lilo.conf so it knows how to boot Windows too).

If you don't want to make a boot floppy, you can use the first Slack disk as a rescue disk IIRC. You could also boot off a LiveCD, mount your Linux partition, chroot into it, and rerun lilo from the chroot encironment.
 
Old 05-27-2006, 03:24 PM   #3
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Rep: Reputation: 30
I tried to do the same thing once. In the end, I ended up wiping the drive clean, install XP, and then Slack.

I think if you just run LILO after installing XP, you might be alright. I hope your drive is partitioned for XP already!?!
 
Old 05-27-2006, 04:00 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The mbr is on the first 446 bytes. The rest contain the partition tables and the mbr signature.

From wikipedia:
Code:
 Address   Function
+---------------------------------------+
| 0x0000   Code Area (446 Bytes)        |
|=======================================|
| 0x01BE   16 byte partition table entry|
|=======================================|
| 0x01CE   16 byte partition table entry|
|=======================================|
| 0x01DE   16 byte partition table entry|
|=======================================|
| 0x01EE   16 byte partition table entry|
|=======================================|
| 0x01FE   2 byte MBR signature (0xAA55)|
+---------------------------------------+
If you create a rescue disk before setting up windows, then you can use it to boot into Linux and use lilo or grub to reinstall the mbr after adding an entry for windows which will be chain loaded.

An alternative is to change your boot entry to the root partition, run lilo or grub to write the bootstrap loader to the root partition, and use "dd if=<root device> of=linux.bin bs=446 bc=1" to write it to a file. Now save the "linux.bin" file on external media or a partition that windows can read so that you can save it to C:\ later on when Windows boots up.

After windows is installed, in windows edit the C:\BOOT.INI file to add an entry to the boot menu to chainload the lilo or grub boot loader.

Code:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows XP Professional" /fastdetect
c:\linux.bin="Linux"

Last edited by jschiwal; 05-27-2006 at 04:10 PM.
 
  


Reply



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
LXer: Backing Up and Restoring Using the cpio Command in Linux and Unix LXer Syndicated Linux News 0 05-26-2006 01:33 PM
Backing Up / Restoring Arrowx7 Linux - Software 6 09-20-2005 08:49 PM
Restoring LILO DOA SUSE / openSUSE 3 12-26-2004 09:04 PM
Restoring LILO Lai Linux - Newbie 3 05-26-2003 12:35 PM
backing up and restoring linux graystarr Linux - General 8 01-06-2002 10:35 AM

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

All times are GMT -5. The time now is 09:56 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