Linux - SoftwareThis 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
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.
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 ?
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.