[NTLUG:Discuss] booting from different root partitions

kbrannen@gte.net kbrannen at gte.net
Mon Jun 30 01:31:38 CDT 2003


Jack Snodgrass wrote:
...
> My drive is set up like this
> /dev/hda1 - /boot
> /dev/hda2 - primary-root-partition
> /dev/hda3 - backup-root-partition
> 
> Now... I normally boot and have /etc/fstab and /boot/grub/grub.conf
> set up /dev/hda2 as / and set up /dev/hda3 as /other_root. 
> 
> I use rsync to backup / to /other_root. 
> 
> Say that I have grub have these options:
> 
> title Red Hat Linux (2.4.20-18.8)
>         root (hd0,0)
>         kernel /vmlinuz-2.4.20-18.8 ro root=/dev/hda2
> 
> title Red Hat Linux (2.4.20-18.8) backup
>         root (hd0,0)
>         kernel /vmlinuz-2.4.20-18.8 ro root=/dev/hda3
> 
> I can boot the "title Red Hat Linux (2.4.20-18.8)" grub label just
> file. It's when I boot the 'backup' label that things go wrong. 
> 
> When I rsync'd the / to /other_root, both of the /etc/fstab files 
> contain:
> /dev/hda2               /            ext2    defaults        1 1
> /dev/hda3               /other_root  ext2    defaults        1 2
> 
> 
> which is right for the 'non-backup' grub lable, but incorrect for 
> the backup version. The backup version should use:
> /dev/hda2               /other_root  ext2    defaults        1 2
> /dev/hda3               /            ext2    defaults        1 1
> 
> so... how can I use the 'SAME' /etc/fstab file but have 
> different 'root' partitions? 
> 
> I know that I can rsync, and then modify the /other_root/etc/fstab
> file afterwards, ... but I'd like to avoid that step if possible. 

Because /etc needs to be "stand alone", sym links are out; you must use 
physical copies.  I think about the best you can do is create your own "grub" 
command, after you "mv grub grub.orig".  Make something like this your new "grub":

#!/bin/sh
cp -p /etc/fstab /other_root/etc/fstab
/sbin/grub.orig    # or whereever grub lives, i don't use it

That way, the "normal" process takes care of the coping and you can forget 
about it.  In theory, you'd put this in both roots.

HTH,
Kevin




More information about the Discuss mailing list