LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2010, 03:44 PM   #1
genese
Member
 
Registered: Feb 2006
Location: belgium
Posts: 76

Rep: Reputation: 20
grub install on spare disk


Hello All,

I copied my system disk to a spare disk.

Both disks are listed in my BIOS "hard disk boot priority list".

How do I install grub on the spare disk in order to boot from it when my system disk is no longer present or when I set my spare disk on top of the priority list ?

TIA
 
Old 02-13-2010, 07:38 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I've never tried it, but thinking how grub works, I believe it would work as follows:

Disconnect the primary drive. Install GNU/Linux on the secondary drive. When you get to the part of the installation which asks where to install grub, elect to install grub to the MBR of the secondary disk.

When installation is complete, reboot to be certain the installation was successful.

Then re-connect the primary drive. You have grub installed to the MBR of the primary drive, so the GNU/Linux installation on the primary drive should allow you to boot to the primary drive.

Once booted into the primary Linux installation, mount the partition on the secondary drive which contains the /boot directory. Open /boot/grub/menu.lst (grub.conf on some distros) and copy the menu entry for the LInux on the secondary drive. Paste that into the /boot/grub/menu.lst on the primary drive.

Thereafter, when you boot, you should see two listings for Linux: one on the primary drive; one on the secondary drive.

If, for any reason, you disconnect the primary drive, the secondary drive has grub in it's MBR, so booting from the secondary drive should be possible.

If you edit your BIOS to boot from the secondary disk first, you may want to also edit the /boot/grub/menu.lst on the secondary disk to include a menu entry for the Linux installation on the primary disk. That way, no matter which disk is first in the boot order in the BIOS, you will see two Linux installations in the menu, and both should be bootable.

If you use disk-by-id in the menu.lst files, instead of hda/sda designations, it should make no difference which disk is first in the boot order. Both should be bootable, and both should allow you to boot both installations.
 
Old 02-13-2010, 07:59 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
No need to re-istall.
From your normal system enter "grub" as root. Then use the "root" subcommand to point to the partition on the copied disk that contains the grub code - say "root (hd1,0)".
The "setup (hd1)" will write the MBR on the second disk.

Comments above re nomenclature apply.
 
Old 02-13-2010, 08:01 PM   #4
genese
Member
 
Registered: Feb 2006
Location: belgium
Posts: 76

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by bigrigdriver View Post
Disconnect the primary drive. Install GNU/Linux on the secondary drive. When you get to the part of the installation which asks where to install grub, elect to install grub to the MBR of the secondary disk.
Since I want to use the secondary drive as backup for the primary, I made a copy of the primary instead of fresh install.

Now, MBR of both disks are the same (copied using dd).

The /boot directory on my spare disk has been copied from a tar archive from my primary disk.

I suppose that the MBR pointer to grub stage1 on the spare disk need to be corrected.

How do I reinstall grub on spare disk ?
 
Old 02-13-2010, 08:24 PM   #5
genese
Member
 
Registered: Feb 2006
Location: belgium
Posts: 76

Original Poster
Rep: Reputation: 20
[SOLVED] grub install on spare disk

Quote:
Originally Posted by syg00 View Post
No need to re-istall.
From your normal system enter "grub" as root. Then use the "root" subcommand to point to the partition on the copied disk that contains the grub code - say "root (hd1,0)".
The "setup (hd1)" will write the MBR on the second disk.
I did it, it worked. Thank you very much !

Quote:
Comments above re nomenclature apply.
What does it mean ?
 
Old 02-13-2010, 08:26 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by bigrigdriver View Post
If you use disk-by-id in the menu.lst files, instead of hda/sda designations, it should make no difference which disk is first in the boot order. Both should be bootable, and both should allow you to boot both installations.
If you are able to use both systems, don't worry about it.
 
Old 02-14-2010, 07:18 AM   #7
genese
Member
 
Registered: Feb 2006
Location: belgium
Posts: 76

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by syg00 View Post
If you are able to use both systems, don't worry about it.
Yes, I changed the /dev/sdX to the "by-id" designation before asking for help here.

Now I must take care to exclude /boot from my backups.

Thanks again to you and to bigrigdriver.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mdadm - re-added disk treated as spare wingnut64 Linux - Server 13 08-09-2022 04:02 PM
Install grub on a USB hard disk (not disk on key) zvivered Linux - Embedded & Single-board computer 4 07-22-2009 10:30 PM
Grub, RAID1 and a spare theooze Linux - General 3 10-15-2008 10:53 AM
Installing a new distro on a spare disk from an old linux bean Subliminal Aura Linux - Enterprise 1 10-27-2006 03:08 PM
IDE Disk has no more spare sectors -- still good for which filesystem? M_F_H Linux - Hardware 1 08-12-2006 01:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:35 PM.

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