booting a cloned disk

Larry Schmid larry@penguinnetworking.com
Mon, 5 Feb 2001 21:57:50 -0700


There are a couple of parameters to add to the lilo.conf for the clone/target 
disk to be recognized as /dev/hda, and installing it is easier with chroot.  
Here's how I install lilo on LFS disks that I build.

The target disk is /dev/hdb.  I mount the root partition on $LFS (/mnt/lfs).  

This is how my $LFS/etc/lilo.conf file looks:

boot=/dev/hdb  		#This will write to the MBR of the target
install=/boot/boot.b	#$LFS/boot
disk=/dev/hdb		#This will cause the system bios
        bios=0x80		# to recognize the drive as hda
prompt
timeout=50
linear
default=lfs
 
image=/boot/lfskernel	#$LFS/boot
        label=lfs
        root=/dev/hda1	#hda1 at boot time
        read-only

Then I cd into $LFS, do a 'chroot $LFS bash' and then run lilo without any 
parameters.  After that, I can dismount the disk, move it into the /dev/hda 
position and it will boot normally.  After the system is up, I change the 
boot parameter to /dev/hda.  I also remove the disk and bios line, though I'm 
not sure that is necessary.  That part can be easily scripted in an of 
several ways before the reboot.  I'll have to add that.  :^)


Larry


On Monday 05 February 2001 19:35, you wrote:
> moin, moin,
>
> I'm building quite a few boxen on the same hardware, so have setup a
> cloning system.
>
> sfdisk makes regenning the partition table a sinch and copying the
> filesystem over is also easy.
>
> The thing I haven't figured out, though, is how to setup the mbr. I don't
> see a way, with lilo, to write the mbr to another drive. I guess I could
> setup RAID 1 and let that do it, but I'm not wanting to right now :). I
> thought of dding the first 512 bytes over, but that presumes the kernels
> are in the exact same places on the disks, which I can't guarantee with
> the methods I'm currently using. I think I can do this with grub since
> it's actually reading the fs, but would prefer to stick with lilo for now
> as that's what the others who would be using this understand.
>
> Currently I boot an install CD into rescue mode, mount the drive and run
> lilo with the -r option.
>
> ciao,
>
> der.hans