An odd one...

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sun May 6 19:37:54 UTC 2007


Frode Petersen wrote:
> This is not a critical problem; I will probably install FC6 from scratch
> instead. But since I started the procedure, curiosity got me, and I just
> have to try and ask for a way to do this. If this long posting is
> ignored, it's OK. :-)
> 
> I have two 250G disks, sda and sdb. On sda there is winXP on a 5G
> primary partition, which have been filled to the limit and beyond, which
> is why I want to enlarge it. Then there is a primary /boot partition,
> 1/4G in size. An extended partition has the rest of the disk. It first
> has a winXP partition that I use for apps, then the rest is allocated by
> LVM for Linux, with one part used for / . The sdb disk has some
> unallocated LVM space.
> 
> I wanted to try to move the Linux LVM partitions to the other drive
> temporarely, creating new partitions there of the same size and copying
> the contents over. The plan was to
>     - remove the LVM partition,
>     - remove it's host extended partition,
>     - then use a similar procedure to move boot,
>     - before recreating a new extended partition, leaving
>         enough space for the new winXP partition.
>     - Then I would reverse the procedure involving the
>         Linux root partition.
> 
> The problem came when I tried to reboot using the copy of the root
> partition. Not finding /proc and (I think) /dev, and finally /dev/root,
> the kernel panicked.
> 
> I changed the menu entry in grub.conf from:
> title Fedora Core (2.6.20-1.2944.fc6)
>     root (hd0,2)
>     kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=/dev/VGsda/LVroot rhgb quiet
>     initrd /initrd-2.6.20-1.2944.fc6.img
> 
> to:
> title Fedora Core temproot (2.6.20-1.2944.fc6)
>     root (hd0,2)
>     kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=/dev/VGsdb/temproot rhgb
> quiet
>     initrd /initrd-2.6.20-1.2944.fc6.img
> 
> (root (hd0,2) points to the /boot partition)
> 
> The problems I see are:
> 1)
> I didn't change the kernel or the (memory?) image file, and I suspect
> that might be one reason. Are there hardcoded references to partitions
> in these files, so that the reference in grub.conf is used only to find
> the kernel, and not tell the kernel where to find and mount the other
> partitions? Has the kernel an 'image' of the disk system on which it is
> compiled?
> 
The /boot/initrd-<version>.img file has information on the LVG
configuration, so if that is changing, you need to build a new
initrd file. man mkinitrd for more information.

> 2)
> The /dev/root special file (as all other special files in /dev were not
> copied over. I tried, but gave up. The command I used was
> 
>     cp -P --copy-contents /dev/root .
> but after some minutes, the copy had grown to several GB, so I aborted
> and deleted the file. The copying probably got caught in some circular
> recursiveness.
> I know the special files are neccesary, but are they generated on the
> fly by the kernel, or do I have to do it manually? And would the lack of
> them in it self cause the kernel panic?
> 
The contents of the /dev directory are created on the fly once udev
is started. If you look at /proc/mounts, you will see an entry:
/dev /dev tmpfs rw 0 0
You do not see it when running mount, probably because it was
mounted before /etc was read/write. But there are a few entries that
are in the /dev directory that are needed before the dev file system
is mounted. The best way I have found to copy them is to boot from a
live CD, mount the file systems, and copy that way.

You also do NOT want to use the --copy-contents option when trying
to copy device entries. You were trying to copy the contents of the
drive partitions, and not the device entry. On top of that, the
"contents" of some device entries appear to be infinite. (/dev/zero
and /dev/random for example.)

As a side note, you can use cp to copy a disk partition, but it is
not usually a good idea. This is especially true for a partition
mounted r/w. (I prefer using dd over cp when doing that type of
copy. Things like "dd if=/dev/fd0 of=floppy.img" can be handy.)

> 3)
> I have to add more entries to the grub.conf entry.
> 
> 4)
> Something I haven't thought of at all.
> 
> I'll probably just reinstall FC6 from scratch, but if someone comes up
> with an idea on how to proceed, I'll try it out first. I just consider
> this as a learning opportunity.
> 
If you want the learning experence, get the System Rescue CD. It can
handle LVM, but unless you copy /etc/lvm/lvm.conf to something like
a USB drive or floppy, you will have to use the lvm tools to
generate the information.

http://www.sysresccd.org/

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!




More information about the fedora-list mailing list