LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   cloning drives + lilo questions (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/cloning-drives-lilo-questions-897732/)

hajiman 08-16-2011 08:36 PM

cloning drives + lilo questions
 
I realize reading a longer post of someone that is asking for help can be unpleasant. Those that take the time and try to understand my issues described below have my gratitude. I am fairly new to linux so please assume all of my attempts below maybe flawed. I would be happy to get feedback on a better way to accomplish my goal.

What I am trying to do.
I have a 160GB IDE hard drive attached to a PC-104 made by Diamond Systems (HELIOS). Slackware 13.7 is installed as the operating system. Partition setup:
1. 512MB SWAP
2. Everything else on remaining hd space.

Lilo is used as a boot loader and is installed to the MBR.

My goal is to transfer the whole system to a 32GB IDE flash drive.

Here is what I’ve done so far.
1. Shrunk the second partition on the 160GB hard drive down to 30GB
2. Used dd to copy the 160GB drive –> 32GB drive. dd fails somewhere in the empty space above the second partition. I am assuming this is ok as long as the partitions and the MBR are copied entirely. “dd if=/dev/sdh of=/dev/sdg bs=1M” When done dd reported the same in blocks as out blocks.

When viewed with fdisk & gparted, the partitions appear to be the same size as the partitions on the 160GB hard drive and can be mounted. The cloned system does not boot though. Right after turning on the PC-104 with the drive plugged in I get “L 80 80 ...” where the 80 repeats itself indefinitely. I am guessing I need to reinstall lilo so my next step was:

3. Try to re-install lilo
a. Attach the 32GB flash disk to another computer(actually a VMWare image with Ubuntu on it) running Ubuntu 11.04 via an IDE-USB adapter. The disk shows up as /dev/sdg
b. I mount it to a directory I created in /mnt called usbhd. “mount –t ext4 –o rw /dev/sdg /mnt/usbhd”
c. “chroot /mnt/usbhd”
d. Ok, this is where I am really lost. How do I run lilo to update the MBR? When I try running lilo (“/sbin/lilo”) without changing lilo.conf it overwrites my boot partition of the VMWare image (fortunately I created a copy of the linux vmware image just for this experiment). Perhaps this is because lilo.conf on the 32GB hard drive has boot & root set to /dev/sda & sda2, repectively, and this happens to be the hard drive designation of the vmware image. So, I tried changing lilo.conf boot & root to point to /dev/sdg & sdg2, respectively, and then ran /sbin/lilo again (on another vmware image copy of Ubuntu).

Am I on the right track? Anyone has any opinions on a better way to do this?

e. Now, when I attach the 32GB flash disk to the PC-104 and try to boot, lilo makes more progress but I get an error which stops the boot during the boot process.
VFS: Cannot open root device “342” or unknown-block(3,36)
Please append a correct “root=” boot option: here are the available partitions:
0000 31293440 sda driver: sd
0001 499952 sda1 0000(lots of zeros)...000sda1
0002 30793472 sda2 0000(lots of zeros)...000sda2
Kernel panic – not syncing: VFS: Unable to mount root fs on unknow-block(3,66)
Pid: 1, comm: swapper Not tainted 2.6.27.6 #2
Call Trace:
... <more stuff here related to call trace>

I don’t know whether I am supposed to run lilo with lilo.conf configured to point to sdg & sdg2 or sda & sda2. It doesn’t seem to work when run on sda & sda2 but that is what the system will be when I unmount it and plug it into the PC-104. I am rather lost at this point. Any feedback/ideas/suggestions are greatly appreciated!

kilgoretrout 08-18-2011 12:35 PM

Quote:

It doesn’t seem to work when run on sda & sda2 but that is what the system will be when I unmount it and plug it into the PC-104.
That's one of the hassles of using lilo. The partition structure has to be the same as indicated in lilo.conf otherwise lilo will refuse to write to the mbr. It's been a while since I've used lilo, but this is what I would suggest. Install your flash drive to your PC-104 in the same configuration that you want to use and with lilo.conf reset to sda. Also make sure your /etc/fstab is showing root mounted on an sda partition. In short, make sure lilo.conf and fstab are in the same state as when you did your dd clone from your hard drive.
Download the Parted Magic iso here:

http://partedmagic.com/doku.php?id=downloads

and burn the iso as an image to a cd-r.

Boot with your partedmagic cd-r and check in the partition editor that your flash drive is being properly picked up as sda. If it is mount your root partition on sda, chroot to that mountpoint as you did prevsiously and try running /sbin/lilo from within the chroot environment. That was the method commonly used back in the day for restoring lilo when lilo was the default bootloader for most distros,i.e. booting from a livecd and running lilo from within a chroot environment.

hajiman 08-22-2011 11:52 PM

Thanks for turning me onto partedmagic cd and the way it used to be done. I managed to get lilo to work again using your suggestions.

It's a weird thing. I made an image of the original hard drive on two different 32GB solid state disks. One I managed to resurrect lilo on (as just mentioned) and the other one I managed (with great first-timer pains) to install grub on.

The one with lilo boots without any major timeouts. However the one with Grub experiences several hickups during bootup. The hickups are two long timeouts while displaying:
Timeout 1. usbhid: USB HID core driver
Timeout 2. Triggering udev events: /sbin/udevadm trigger --type=failed

Why would an exact copy of an operating system installed on identical (brand, size, make, model) drives have an issue when booting via grub but no such issue booting via lilo? I am asking out of curiosity. My system is in good enough shape to work with now that lilo is back up and running.

Thanks for your help!


All times are GMT -5. The time now is 02:17 AM.