fedora physical-to-virtual disk migration

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 might hang 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:

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.


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

or to be more portable for future use: