[CentOS] Moving/copying the MBR

Wed Apr 11 18:05:15 UTC 2007
Luciano Miguel Ferreira Rocha <strange at nsk.no-ip.org>

On Wed, Apr 11, 2007 at 10:48:36AM -0700, Mark Hull-Richter wrote:
> Are there any tools for working with and moving or copying the MBR?
> 
> My machine has 2 PATA drives (hda & hdb) and 2 SATA drives (sda & sdb).  The
> MBR is on hda,

Actually, its on every drive. The BIOS just boots the first it cans (by
a configurable order).

> but I would like (eventually or sooner) to boot from sda
> because it is two years newer, faster and, hopefully, more reliable.  Even
> if I don't change that, I'd like a backup MBR on sda in case hda fails (hdb
> has gone sour a few times due to something in the power setup, although no
> data lost and it always comes back).
> 
> In order to copy the MBR, I'd also need to edit it because the drive
> configuration would be different, as well as the location of my /boot
> partition.

So you don't want to backup hda's MBR to sda, you just want to also be
able to boot from sda.

So, you'll need to create the extra boot partition on sda, format it,
copy /boot data to the new one, umount /boot; mount newboot /boot; and
then, depending on your boot loader:

a) lilo:
  1. change boot=/dev/hda to boot=/dev/sda (in /etc/lilo.conf)
  2. make sure disk=/dev/sda exists and is correct (also in /etc/lilo.conf)
  3. lilo -v

b) grub:
  1. make sure /boot/grub/device.map has the correct value for sda
  2. change (hd0) to the sda device in /boot/grub/menu.lst
  3. execute grub-install /dev/sda

Note that disk= and device.map specifies the device name on boot. If you
change the BIOS boot order to boot sda first, then sda will still be
bios=0x80 (lilo) and (hd0) (grub).

Anyway, I just recomend the creation of a boot cd with /boot and fix
/boot when the need arrives.

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20070411/ea0d9140/attachment-0004.sig>