LILO boot problems after moving Linux installation to larger hard drive

Q I found that I needed a bigger hard disk, so I plugged one in as hdb, partitioned it as I wanted, copied file systems from the old drive (hda), and tried to boot from the new one. Unfortunately, this operation turned out to be unsuccessful. I made and copied partitions for /, /boot, /usr, /home, among others. I also make a swap partition. /boot is primary partition 1, marked bootable. I wrote an mbr record, using lilo -M /dev/hdb1. I mounted the new /boot and / partitions, edited the new copy of /etc/lilo.conf, (now in /mnt/hdb5), and ran lilo -C /mnt/hdb5/etc/lilo.conf -b /dev/hdb1, which appeared to work. When I try to boot from the new drive, I get through Lilo's boot choice screen, and a fair amount of other stuff, ending with:

initrd finished
Freeing unused kernel memory
Warning: Unable to open an input console

After that, only the reset button on the box will make anything happen. This is "Mandrakelinux release 10.2 (Limited Edition 2005) for i586"

A This is not a problem with the bootloader. Once the kernel has loaded, the bootloader's job is done. This error looks like a missing file from /dev, probably /dev/console. Although the dynamic dev filesystems, like udev and its predecessor devfs, create your device nodes in /dev automatically, there are some that are needed before devfs/udev start up. I suspect that you omitted the contents of /dev when making a copy of your root partition, either by not including it in the copy command, or by excluding all other filesystems when copying (you didn't mention how you copied the filesystems, but cp, rsync and tar all have options to exclude other filesystems). The contents of your original /dev directory are now hidden because a new, dynamic /dev/ has been mounted on top of them, but as you will see, they are still accessible.

mkdir /mnt/tmp
mount --bind / /mnt/tmp

will make your whole root filesystem available from /mnt/tmp, without any of the other filesystems that are mounted at various points. So /mnt/tmp/home will be empty while /mnt/tmp/dev will contain a few device files. Copy these to dev on your new root partition and your boot error should disappear. The easiest way to ensure your new root filesystem contains exactly the same files as your current one is

rsync -a --delete /mnt/tmp/ /mnt/newroot/

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar