Can't clone FC6 using tar-backup and restore
I've set up a working FC6 system which I am trying to clone onto some of my other machines. The problem is that the cloned systems are hanging during the boot process, even though the file system appears OK.
The procedure I'm following is as follows... This process has worked faultlessly for FC3/4/5 and I've done it *many* times on many different machines with different hardware without trouble.
1) Set up the FC6 system I want to clone. I custom-partition so that there's one "/" partition and a swap partition. "/" is formatted as ext3.
2) Boot knoppix on this machine. Mount the "/" partition and take a full tar backup onto a network partition.
3) Boot knoppix on the machine where I want to dump the clone and mount the network partition containing the cloned tarfile.
4) run fdisk to create "/" and a swap partition on /dev/hda. Format the "/" partition as ext3.
5) untar the tarfile off the network onto /dev/hda1 (the "/" partition).
6) run grub-install --root-directory=/mnt/hda1 /dev/hda
7) Reboot knoppix and the cloned fedora system should reboot happily - but it doesn't
During boot, the last few lines on the console read as follows:
blah blah blah
kjournald starting. Commit interval 5 seconds
EXT3-fs: recovery complete
EXT3-fs: mounted filesystem with ordered data mode.
Setting up other filesystems.
Setting up new root fs.
no fstab.sys, mounting internal defaults
Switching to new root and running init.
umounting old /dev
umounting old /proc
umounting old /sys
exec of init (/sbin/init) failed!!!: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
And there it hangs...
The system from which I cloned displays exactly the same console output up until the "exec of init (/sbin/init) failed!!! (of course, it doesn't fail and continues)
For some reason, its not finding the "/" partition, but I'm sure "/" is there and its an identical clone of the source machine, including /sbin/init which apparently cannot be found. I'm betting there's something funny about the way I format the drive and restore the tarfile that breaks the way that FC6 boots, but which worked just fine under previous versions.
Any ideas or advice??? Is there another (better) way of cloning an FC5 system onto a different dimension hard drive?
(I've considered partimage, but my source disc is 40GB and I have several computers with smaller drives. Partimage won't restore to a smaller partition than the source. I think this is also the case with dd)
But you could, as far as I know, use dd to create a smaller image than 40GB, which would fit to the new drive. I think you can pass a parameter to dd that tells how much you want to copy.
You could also try out cpio archiving, I might not know it's every difference to tar but one thing is that tar refuses to archive special files whereas cpio doesn't. It's worth a try at least.
To unarchive a cpio archive file: first cd to the directory where you wish the contents to be unarchived (cpio has a switch to archive/unarchive the files so that they will get dropped back to exactly where they were on the copy-out'ed system): here we first move to root, then check out the contents of the archive (second line) and if it seems ok, the last line unarchives the contents.
Thanks for the suggestions. I believe that dd makes a literal sector by sector copy of the drive without discriminating between empty and used sectors. So you can't use dd to copy from a large partition onto a smaller one, and you run into trouble copying from a smaller partition to a larger one too. As I understand, dd is designed to copy between like-sized partitions.
cpio generated the same results as tar. That is, a restored backup of FC6 it doesn't boot this way either.
I've now also tried restoring a tar backup onto *the same* partition that it came from. This also doesn't work with FC6 but as mentioned before, works with previous fedora versions!
I'm suspecting the problem has something to do with a difference between the knoppix 5.0.1 and FC6 versions of either
grub-install (or grub in general).
Does anybody know anything about this?
progress - but why?
I've made progress on my own problem... still confused.. Can anybody help point out why this works...
Instead of booting knoppix 5.0.1, I have booted the FC6 installation disc and used rescue mode.
When the FC6 rescue mode found my /dev/hda1 partition, I told it to mount read-only.
At the command prompt, I immediately unmounted the partition, and formatted using the same mke2fs command I issued under knoppix.
Then I mounted my network nfs partition holding my tar backup and the newly formatted /mnt/hda1
I untarred the FC6 backup off the network partition onto the hard drive - again using an identical command as I'd folloed under knoppix.
I then tried to grub-install, and found a bug in the FC6 rescue disk.... The grub-install script looks for grub in /sbin/grub, yet it's located at /usr/sbin/grub. After manually copying /usr/sbin/grub to /sbin/grub, I ran the identical grub-install command that I'd run under knoppix.
I then rebooted - and FC6 came up perfectly.
So there's a difference between mke2fs, tar or grub between knoppix-5.0.1 and FC6. Which one is it and what is it that is different that's causing the problem???
Several days ago, I posted (above) that I'd made progress on restoring FC6 from a tar backup. Alas, it now looks as though this one occasion was a fluke. I have not been able to repeat it.
The symptoms are the same as noted before. When I tar up an FC6 installation, rebuild a hard drive using mke2fs and then untar back, the system won't boot. I've tried around ten more systems since my one success above, and all fail the same way. When I reformatted that one system that worked and tried again, it also failed using the same approach that worked before.
When I install FC6 off DVD, it works every time on all machines that fail to restore from tar backup.
I've got two old FC5 backups. Both of these untar and boot no problems on all machines.
I am now pretty sure its not grub. Grub seems to load the kernel and initrd OK every time. Its when changing over from the initrd filesystem to the hard drive that the boot hangs - allegedly not finding "/sbin/init".
I've been wondering whether the FC6 kernel has included some sort of mandatory selinux requirements that are not fulfuled when you simply do a mke2fs and restore from a security-unaware tarfile.
I also noticed that if I format the drive as an ext2 filesystem (ie don't use the -j parameter to mke2fs), then the FC6 boot craps out even earlier.
I use now FC6. I have selinux disabled, never tried it with selinux enabled.
The only times I had the 'kernel panic, not syncing' it was due to either a misconfigured '/etc/fstab' os a misconfigured '/boot/grub/menu.lst'.
Doenst look to be your problem, since you are cloning a /dev/hda1 to a /dev/hda1 in the new machine, which is not my case. I have to change '/etc/fstab' to mount the correct partitions, and in 'menu.lst' I have to take care of the lines 'root (hd?,?)' and 'kernel ....'.
Anyhow, since you restore thru knoppix, from knoppix do a 'chroot /mnt/hda1' and take a look at the new system.
A completely different problem are the hardware differences between the 2 machines and how the kernel modules are built.
A kernel will happily boot on a IDE disk, but it will fail on a USB disk (and probably SATA) if the usb kernel
driver is not built into the kernel or, if built as a module, in 'initrd'.
This will give a kernel panic, and it will not find '/bin'/init' because it can't mount the root file system.
To clone to a USB disk, I use:
'mkinitrd --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod \
Thats all I can think off
It may just be an issue with the LABEL=/ thingy in /etc/fstab and /boot/grub/grub.conf .
I found that sometimes the copied system needs to have the /dev/hda1 ( or whatever ) instead of using LABEL=
At any rate, here's how I do it.
I make a gz file while still booted into my original system by using find and cpio. That saves me the step of booting up with a livecd.
Once booted up, I format the partition, mount it and the nfs share which is located on the machine 192.168.0.1 .
At the prompt ( sh-3.1# ), it goes like this...
Try using DAR.
Works like a charme.
Unfortunately, I haven't had good luck with this process. The error I receive is as follows:
(cd / ; find . -xdev | cpio -voc > /mnt/backup/fedora/linux.cpio.gz)
cpio: mnt/backup/fedora/linux.cpio.gz: field width not sufficient for storing file size
If anyone knows why this happens, please let me know.
Gads, I hate it when people dig up my old posts so everyone can see how stupid they are. :)
Fist off, the LABEL=/ part is because the partitions are actually labeled at install time. You can do that manually when you create a partition.
If you want to label swap partitions, I do it like this...
(cd / ; find . -xdev print0 | cpio -voc > /mnt/win/backup/linux.cpio.gz)
Figured I better check in with my progress as you were kind enough to reply.
Below is what I've tried:
To successfully use the command,
(cd / ; find . -mount | cpio -voc > /mnt/backup/fedora/linux.cpio.gz)
(mount same as xdev)
I had to nfs mount the directory /mnt/backup/fedora on the built system.
That appeared to have worked. Then everything thereafter also worked.
Thanks also for pointing out that the label may need to be /1 (it did).
Just used "e2label /dev/hda1 /1". The system now comes up, but I've
got some network issues I'll need to iron out.
Thanks again for all of your help. This looks like a winner.
|All times are GMT -5. The time now is 09:27 AM.|