FC13: Migrating a KVM O/S image disk to a larger one - can't log in after it boots...
Using virt-manager on Fedora 13 (FC13), I installed an FC13 guest on an image disk.
Nothing special there. Even though I only installed the minimal distribution, it turns out
my 4GB image disk size would be too small once I started adding the software I needed.
So while the VM was shut down, I basically created and migrated the O/S from the 4GB disk
image to a 12GB disk image I manually created, using cpio(1). Sparing you the (elsewhere
well documented) process details to set this all up using dd(1), fdisk(1), mke2fs(1), losetup(1),
and kpartx(1), the actual copy part was accomplished as follows:
root# cd /mnt # this is where the 4GB source is mounted (read-only btw).
root# find . | cpio -pudm ../mnt2 # /mnt2 is where the 12GB dest is mounted r/w.
root# blkid # (Inspect the output, and note the appropriate UUID's for the new disk image).
root# vi /mnt2/boot/grub/menu.lst # (Make adjustments to the UUID's on the kernel line).
root# vi /mnt2/etc/fstab # (Make adjustments to the UUID's for root and swap entries).
root# Here I install a GRUB sector onto the new disk image (details omitted because it worked).
Next I basically unmounted the filesystems, tore down all the temporary logical
(losetup and kpartx) device stuff for the image disks. So far so good.
Finally I rename the disk images so that the 12GB disk image assumes the expected name for
that VM that the KVM expects. The O/S was file-for-file transferred from the 4GB disk image to the
12GB disk image.
Ok: I boot the VM (using virt-manager). It boots clean, and gets to a login prompt.
However, when I attempt to log in via the console, as root, or as myself (non-root), the O/S
logs out immediately, and goes right back to the console login prompt. It does it so fast, that I
can make out what the issue is. It's almost as if it's having an issue with spawning a login
So I'm guessing that, in addition to making post copy adjustments to the grub.conf and fstab
files (as indicated above), there must also be something else I need to do on the new image
to overcome this issue. Any thoughs?
Note I can't log in over the newtork yet (because I haven't set that up yet - recall that it's
a minimal install). So ... think Console. What file needs updating for console/login process
Thanks in advance.
---------- Post added 2010-06-13 at 12:00 AM CDT ---------- Previous post was 2010-06-12 at 10:31 PM CDT ----------
I figured it out. I had not disabled selinux in the source image yet and, while that didn't cause any login issues, it did after migrating to the larger disk image. The give away was the login error I received once I tried to log in via a network connection, as opposed to via the console. The message was "Unable to get valid context for root" (or for
whatever user you tried to log in as).
Once I disabled selinux (both in the /etc/selinux/config file, and also by passing the selinux=0 directive to the
kernel line of the grub.conf file), login's proceeded without issue.
Hope this help others.