Bootable FC9 Disk Copy

Ken Smith kens at kensnet.org
Mon Sep 1 22:06:40 UTC 2008


Nickolas Gray wrote:
> I am attempting to create a bootable copy of a running SELinux box on 
> FC9. I think I am close but I am coming up with a kernel panic (text 
> at end) Here are the steps and a brief reason. If anyone has any 
> suggestions where I might have made a mistake or left something out a 
> comment would be appreciated. The only requirements so far is that it 
> has to be a disk to disk copy with no CD/DVD rescue involved and it 
> has to use LVM Snapshot.
>
> The original looks like
>
> mbr on boot sector
> /dev/sda1  ext3 /boot
> /dev/sda2  LVM
>
> VolGroup00/LogVol00 is root
> VolGroup00/LogVol01 is swap
>
> This is what I am doing.
>
> • This seemed like an efficient way to dup the filesystems of the 
> source to the target.
> sfdisk -d /dev/sda | sfdisk /dev/sdb
>
> •Duplicate the MBR
> dd if=/dev/sda1 of=/dev/sdb1 bs=512k
>
> •Copy the entire /boot from a to b
> dd if=/dev/sda of=/dev/sdb bs=664 count=1
>
> •Add the /dev/sdb2 to LVM
> pvcreate /dev/sdb2
>
> create the VolGroup for /
> vgcreate -s 32m VolGroup01 /dev/sdb2
>
> Create the logical volume for / and swap
> lvcreate -l 1562 -n LogVol00 VolGroup01
> lvcreate -l 62 -n LogVol01 VolGroup01
>
> Create the swap area
> mkswap /dev/VolGroup01/LogVol01
>
> Format the / filesystem
> mkfs -t ext3 /dev/VolGroup01/LogVol00
>
> Create the snapshot
> lvcreate -L 20g -s -n snap /dev/VolGroup00/LogVol00
>
> Mount the snapshot
> mount /dev/VolGroup00/snap /snapshot
>
> Mount the target
> mount /dev/VolGroup01/LogVol00 /target
>
> Rsync over the snapshot
> rsync -vXxpr  /snapshot/* /target
>
> Unmount the snapshot
> umount /snapshot
>
> lvremove -f VolGroup00/snap
>
> At this point I fixed the initrd, the fstab and grub.conf on the 
> target to point to VolGroup01 instead of VolGroup00.
>
> I would think this should be it.
>
> What I get is.
>
> root (hd0,0)
> Filesystem type is .....
> kerne /vmlinuz ......
> Linux bzimage.....
> initrd / initrd ....
> Linux initrd
>
>
> Decompresing Linux ... Done
> Booting the kernel
> Red Hat nash version 6,0,52 starting
> Reading all physical volumes this make take awhile ....
> Found volume group VolGroup01 now active
> ERROR: exec of init (/sbin/init) failed failed!!!! No such file or 
> directory
> ERROR:  failed in exec of /bin/echo: No such file or directory
> a couple messages about not finding /bin/sleep
> Kernel Panic
>
> I am not really sure where this is getting to. I thought it was 
> getting to the initrd but now I am not sure.
>
> Thanks Nick
>
In that NASH script runs just before the error the running system 
volumes are mounted. It is compiled at install time to mount the right 
LV. If the LV has changed the kernel will panic because it can't find 
/sbin/init. See here 
http://www.whoopis.com/howtos/linux_lvm_recovery.html adapt the 
narrative to suit your situation.

Ken



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the fedora-list mailing list