fedora
configurationoperating_systemslinuxfedora

How to migrate from a virtual machine to a native host #

Normally one might simply take a disk, put it in another computer and start it there as a virtual machine e.g. by using kvm, xen or virtualbox. But in some cases the system hangs while booting and if you are very patient you will eventually get a message, that the UUID of the disk could not be found. The dracut shell helped me to find the cause of that error: ls /dev/ simply showed no active disk devices (were you would expect hdX, sdX or vdX devices). This implies that their drivers are missing in the kernel. As this whole rescue shell comes from the initramfs image: How to add those drivers to it? Well: Start your virtual machine again using a virtual IDE interface and issue:

dracut -f /boot/initramfs-$(uname -r).img 

That will replace your initramfs in place and because dracut is smart enough to detect, that it runs in a virtual machine it will add those drivers this time. Further investigation leads to /usr/lib/dracut/modules.d/90qemu/module-setup.sh, which causes the exclusion of virtio_blk when dracut does not detect the virtualization. This script also depends on systemd-detect-virt. After that is done you can safely switch back to the virtio disk driver, which is much faster.

edit #

This all breaks down in adding the needed drivers by hand:

drivers+="xen-blkfront xen-netfront virtio_blk virtio virtio_ring virtio_pci ata_piix ata_generic pata_acpi cdrom sr_mod ahci virtio_scsi"

or to be more portable for future use:

hostonly="no"
top