I have this problem (well larger but it can be stripped down to this) - headless machine far, far away, with two discs
/dev/sda is "working disc" with a lot of partitions, mainly
/dev/sda1 .. /boot
/dev/sda2 .. /
/dev/sdax .. something other
installed with grub 0.97
the clasiccal gentoo way (boot from CD, chroot, install everything, run grub
type root (hd0,0)
and setup (hd0)
and it works)
/dev/sdb is "backup disc" with similar partition scheme, but different size and partition sizes
/dev/sdb1 .. /boot
/dev/sdb2 .. /
/dev/sdbx .. something other
added much later as free disk for "data backups", later it was desided, that it should be rather "reserve system", so some kind of synchronisation process was established, which mounts sdB
partitions, picks up files from sdA
, rearrange them to new patritition scheme (compressing something, ommiting something else, adding extra backups etc, etc), then again unmount sdB
.
At that point the sdB
is good enough copy of sdA
, that if sdA
crashes, the sdB
should have all files needed to be able take its work and start be new sdA
. All needed to do that is that somebody stop the machine, detach physically old sdA
, while leaving sdB
intact and reboot the machine. But that dic never was prepared to be bootable, grub was not installed there, just copied as buch of other files. So it would not run grub
on start. It would not boot. It is only data disc, rewriten with zeroes, then partitioned, formated and filled with files.
As even booting paramaters are sometime changed on sdA
/boot/grub/grub.conf, new kernel may be used etc etc, the content of sda1
partition is also backuped to sdB
. The /etc/fstab
is written, that it would work on either disc (if it is marked as sdA
by system)
My question is - how make the second disc bootable too now, from far, far away with just ssh access to the machine.
I think that it would be something simple, like running grub
, typing root (h1,1)
and setup (hd1)
and quit
or so, but I am not sure, how to express, that I am installing it on sdB
(or hd1
for grub), but when it would be booted, the only disc in the computer will be the "backup disc", so it will be sda
(hd0
) then and it should boot from files on itself.
But I have just one try and nobody with technical knowledge, console or keyboard on the other side, just simple man with screwdriver instructed "in case o problem just switch off this machine, pull out disc marked WORKING DISC
, do not touch disc marked BACKUP DATA
and switch the machine on" (I can rely on that done correctly, but that is all) and it must work.
Status now (and it boots all from sda
):
sda # work disc
sda1 /boot
sda2 /
sdb # backup disc (unmounted)
sdb1 /boot
sdb2 /
New status wanted (and it should boot all from new sda
):
# work disc (not present at all)
sda # backup disc (mounted and single in computer)
sda1 /boot
sda2 /
Thanks in advance. (Yes, I went to that too late, but it is the situation now and it should be solved fast)
grub-install --boot-directory=/mnt/sdbOS/boot /dev/sdb
may help. Dont forget togrub-mkimage
for sdB. That should install the boot sector to sdB and "point" it to the grub.cfg on sdb1. Please check the switches for correct locations before executing.fstab
uses simple/dev/sda1
, noLABEL
norUUID
. There is nogrub-mkimage
anywhere. Thegrub
islegacy
or0.97
, notgrub2