[CentOS] Kernel panic when adding partitioned virtio disk

Thu Mar 19 18:56:58 UTC 2015
James B. Byrne <byrnejb at harte-lyne.ca>

On Wed, March 18, 2015 10:59, m.roth at 5-cent.us wrote:
> Hi, James,
>
> James B. Byrne wrote:

>> Kernel panic - not syncing: Attempted to kill init!
> <snip>
> Now, admittedly, a) I really haven't been following this thread, and
> b) haven't worked a lot with VMs, and not with KVM, but could you
> clarify something for me? Are you trying to make the virtual root
> disk larger, or are you creating a new one, and just adding it the
> the VM, like mounting another drive on an existing system? If the
> latter, can't you mount it?
>
> Oh, and is the new virtual drive formatted?
>

I discovered my error and have corrected it.  I am just providing this
information in case someone else does something similar.

The situation is this.  I have a KVM guest that I keep as a clone
template. It has one virtio disk of 32GB that is configured as an LVM
partition with several lvs.

I cloned this system to create an off-site backup host for our fax
server.  The archives of which exceeds 32GB by some margin.  My
requirement therefore was to create the necessary additional storage
(2 x 32Gb virtio disks) and attach them to the cloned system.
Initially this worked as it has in the past.  However, I ran into a
problem on the new guest when adding a new lv using the space from the
new virtual disks that I had added to the volume group defined on the
guest.  And this is where I made my mistake.

Instead of removing the lv first and then removing the virtio disks
from the vg I deleted the disks from the guest.

This meant that the guest LVM manager was looking for those drives
whenever it was rebooted.  If the drives that I added back in
subsequent trials were not partitioned then they were not found by the
lvm manager and the system booted.  If the re-added disks were
partitioned then the lvm manager found them, but they were not the
disks expected.  That probably tripped some sort of security or
consistency check and that caused the kernel panic.

The fix was to boot the system without the added disks.  Then login
and run the lvm utilities to remove the dangling lv, also remove the
missing pvs from the vg, and then shutdown.  Once this was done adding
new partitioned virtio disks to the guest proceeded as expected and
the problem disappeared from the next boot.

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3