Then you have to prepare lilo to make the new disk bootable by editing the file
Note: Make sure you use an initrd image to boot. Otherwise there is no way to influence the boot sequence to make it possible to mount the USB memorystick containing the disk key.
disk=/dev/hdb bios=0x80 # Tell LILO to treat the second disk as if it were the first # disk (BIOS ID 0x80). boot=/dev/hdb # Install LILO on second hard disk. map=/mnt/boot/map # Location of "map file". install=/mnt/boot/boot.b # File to copy to hard disk's boot sector. prompt # Have LILO show "LILO boot:" prompt. timeout=50 # Boot default system after 5 seconds. (Value is in tenths of # seconds.) image=/mnt/boot/vmlinuz # Location of Linux kernel. The actual name may include a version # number, for example "vmlinuz-2.0.35". label=linux # Label for Linux system. initrd=/boot/initrd.img # the ramdisk image for this partition root=/dev/hda2 # Location of root partition on new hard disk. Modify this as # appropriate for your system. # Note that you must use the name of the future location, once the # old disk has been removed. read-only # Mount partition read-only at first, to run fsck.
After that is done, you can run lilo to install the new configuration on the second harddisk with
$ lilo -C /mnt/root/etc/lilo.conf
You should, of course have your current
lilo.conf file somewhere in a backup or you will have to recreate it manually. In my oppinion its a good idea to keep a copy of
lilo.conf on the boot partition anyway since the original one in
/etc/lilo.conf might be unavailable if you run an encrypted root partition.
The procedure then is quite simple.
$ lilo -C /mnt/hda1/lilo.conf -s /mnt/hda1/boot