Difference between revisions of "Switch to Virtual Hardware Drivers"
Line 1: | Line 1: | ||
+ | '''This page is in a Draft stage and still requires additions and clarifications.''' | ||
+ | {{Level|Developer}} | ||
The only documentation available for switching from normal hardware drivers to virtual hardware drivers would be by following the procedure described in http://wiki.contribs.org/UpgradeDisk | The only documentation available for switching from normal hardware drivers to virtual hardware drivers would be by following the procedure described in http://wiki.contribs.org/UpgradeDisk | ||
Revision as of 00:59, 14 December 2012
This page is in a Draft stage and still requires additions and clarifications.
The only documentation available for switching from normal hardware drivers to virtual hardware drivers would be by following the procedure described in http://wiki.contribs.org/UpgradeDisk
Though that might be the correct way of doing it, it might break customizations and a shorter method exists. It also does not include advice on switching the network drivers, which is a simple process but there is a small catch.
The reason for being interested in this procedure would be because virtualization still suffers from severe IO bottle-neck issues and using the virtio drivers makes the performance hit a bit less.
This is a rundown of the method I used for a SME 7.5.1 that was installed on the default libvirt options (non-virtio) to change it to a higher performance virtio VM
1. Starting with the network drivers
1.1.1 Using a libvirt GUI (virt-manager)(the MAC changes) under the hardware tab of the VM, remove the network card and then add a new one, taking care to specify the type as virtio
1.1.2 Or if using virsh (the MAC stays the same)
do a "virsh edit smeserver" find the network interface and change the model type to virtio escape and ":wq" to save the changes If everything worked no error messages will appear
1.2 After a "signal-event shutdown" in the VM and boot, SME server should complain about not finding the network interface. Do a configuration to fix the network interface and reboot
1.3 For a 2 interface server, test to make sure the correct interface is connected to the internal network and the correct one is connected to the external, otherwise do configuration again to change the network interfaces.
2. The mischievous disk block drivers (needs serious editing)
2.1. On the old SME server prior to shutting down, at the root command prompt issue the command /sbin/e-smith/signal-event pre-backup then shutdown
2.2.1 Using libvirt GUI (virt-manager) under the hardware tab of the VM, remove the harddisk but do NOT delete the disk image. Then add a new storage, taking care to specify the type as virtio and using the previous disk image.
2.2.1 Or using virsh
do a "virsh edit smeserver" find the disk device and change the target to dev='vda' bus='virtio' escape and ":wq" to save the changes If everything worked no error messages will appear
2.3 connect the sme install iso to the cd interface or put the sme install disk in the VM server optical drive and set the VM to boot from cd
2.4 Boot from SME Server 7.x install CD
press F5 type "sme rescue" at the command prompt and hit enter OK through the menus. There should be a quick pop-up when the virtio_blk driver is automatically loaded.
Skip the network interface but attempt to mount the previous installation. The SME server should now be mounted under /mnt/sysimage so continue to "chroot /mnt/sysimage"
This is where it gets hairy
do "vim /boot/grub/device.map" and change the /dev/hda to /dev/vda just to be sure, do "modprobe virtio" and "modprobe virtio_blk" or follow http://lists.centos.org/pipermail/centos/2010-March/091962.html remove the latest initrd ex. "rm /boot/initrd-2.6.9-89.33.1.ELsmp.img" create new initrd ex. "mkinitrd /boot/initrd-2.6.9-89.33.1.ELsmp.img 2.6.9-89.33.1.ELsmp --with=virtio -- with=virtio_pci --with=virtio_blk exit umount -a
then shutdown or "virsh destroy smeserver"
2.5 Some extra steps I did was to follow http://wiki.contribs.org/UpgradeDisk before doing the chroot, but in hindsight that might not have been needed.
3.1 Disconnect install cd image / remove install cd. Change the boot device to harddisk.
3.2 Boot, Benchmark and check for performance improvements.
Another way (the correct way that uses much more time and disk space possibly creating fragmentation) of accomplishing a switch-over would be to follow http://wiki.contribs.org/UpgradeDisk and making sure to create the new virtual hardware with the virtio mode before the step of installing the new SME server.
More hints is to possibly not combine LVM, ext4, qcow2, LVM, ext3, as it might cause image corruption during a power failure as well as fragmentation and performance hits.
Extra virtio modules that might not be needed are virtio, virtio_pci so try skipping them if you dare.