FeaturesWP CloudPricingEE CLIContactMy Account
Features
Team Access & User Permissions
Install
Resources
Community
CLEAR
Tutorials
KVM
Enable virtio for existing VM’s
Topics
On this page
-
- Getting Started
- Git and File-System Layout (non-default setup)
- Version Constraints
- Managing Themes and Plugins (for entire WordPress site)
- Updating Themes and Plugins (for entire WordPress site)
- Adding Composer Support to Your Own Themes and Plugins (for developers)
- Using Composer to Manage Own Theme/Plugin Dependencies (for developers)
-
- Assigning Multiple IP Addresses to Single LAN Card
- Disable IPv6 on Ubuntu 12.04
- dsh – distributed shell
- fdupes – find & replace duplicate files with hardlinks
- GPG Keys Cheatsheet
- Increase "Open Files Limit"
- kill all php, nginx, mysql or any kind of processes
- Passwordless Authentication for SSH
- Screen
- search replace in multiple files useing grep xargs sed
- Setup sftp
- sysctl.conf
- Timezone Sync
- Using Google Public DNS on Ubuntu Server
- Using openssl to match private key, cerificate and CSR
- Configure Postfix to Use Gmail SMTP on Ubuntu
- Logrotate Example for Custom Logs
- PHP 5.5, MySQL, Postfix, Nginx and WordPress on Ubuntu
- Serverdensity
- Upgrade Ubuntu 10.04 to 12.04
- Using find and sed to replace strings in multiple files
- Webmin
-
- .my.cnf – mysql user & password
- Analyse slow-query-log using Anemometer
- Improving MySQL Query Cache
- MySQL Query Profiling
- Reset MySQL root password
- tuning-primer.sh – an alternative for mysqltuner
- Using MariaDB 10
- Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
- Change WordPress Domain Name
- Character Sets and Collations
- Enable innodb_file_per_table
- Enable Remote Access (Grant)
- Installing Percona Toolkit
- Using tmpfs for temporary folder creation
- YARPP and InnoDB
- Convert MyISAM to InnoDB
- Using tmpfs for mysqldump & mysqlimport
- Convert from INNODB to MYISAM
- Analyse slow-query-log using mysqldumpslow & pt-query-digest
- mysqlcheck with cron to optimize automatically
- Using MySQLTuner to Optimize MySQL configuration
-
-
- Directly connect to PHP-FPM
- Generating core-dump for php5-fpm
- GeoIP
- Having php5 and php7 on same system.
- Install Xdebug and configure it with webgrind
- Installation of PHP Code Review Tools
- memcache
- PHP's Zend Opcache Config & Web Viewer
- Setting Sqlite support with PHP
- Using HHVM with PHP-FPM Fallback
- Using Redis for PHP Sessions on Ubuntu Server
- Installing PhpMyAdmin Quickly
- Moving PHP's session storage to tmpfs
- Install Xdebug and configure it with Netbeans
- Nginx – Enable PHP-FPM Status Page
- PHP-FPM: Socket vs TCP/IP and sysctl tweaking
- APC Cache Optimization & Monitoring Using Web Interface
- Checking if PHP/WordPress can send mails
- Debugging PHP Scripts Using slow_log and more
- Increase file upload size limit in PHP-Nginx
- Increase PHP script execution time with Nginx
-
- Performance Optimization
- Remove Query string of css/js files
- Setup ElasticSearch with ElasticPress
- Using Redis for WordPress Object-Cache
- WooCommerce Window Shopping Caching Technique
- Moving WordPress To New Server (Faster)
- Better wp-cron using linux's crontab
- 404 error- Page not Found!!!
- Debugging WordPress with Nginx
Backup VM config
Edit VM Config
Changes to Guest VM's filesystem
For changes to reflect
Enable virtio for existing VM’s
On one of our host machine, we get around 70MB/second disk write speed, but KVM guest machine was giving us around 18MB/s write performance.
At that point we came to know about virtio driver. Here is guide to enable virtio
Backup VM config
virsh dumpxml <vmname> > ~/vmname.xml
Replace vmname with Virtual Machine (Domain) name. You can find correct name by running virsh list --all
Edit VM Config
Run following command to open editor.
virsh edit <vmname>
Find lines like below:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/ubuntu-kvm/tmpU2z98r.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
Make following changes:
- Replace
hdawithvdaANDidewithvirtio - Remove following line:
<address type='drive' controller='0' bus='0' unit='0'/> - Add
cache='none' io='native'option todriver.
Your update config will look like below:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none' io='native'/>
<source file='/var/lib/libvirt/images/ubuntu-kvm/tmpU2z98r.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
Save your changes and exit editor.
Changes to Guest VM’s filesystem
I am not sure if this step is necessary but one tutorial mentions this. I did not try outcome without this step as VM’s I was playing with has some critical data.
Anyway, login to Guest VM’s shell and open in editor vim /etc/fstab
Fine lines like /dev/sdX. Replace 's' with 'v'.
So /dev/sda1 will become /dev/vda1 and /dev/sda2 will become /dev/vda2 and so on.
For changes to reflect
Shutdown Guest VM for its shell. You can use command shutdown 0
Next, from Host machine, run following commands:
virsh destroy <vmname>
virsh start <vmname>
virsh reboot won’t work.
At this point you can run your disk I/O benchmarks again to check speed.
In our case performance shoot-up from 18MB/s to 40.8 MB/s.
Convert qcow2 to raw format
PREVIOUS
Comments
-
shrijan
Hi
Am using KVM in linux. My guest is windows 7. I had a problem windows 7, so i deleted it and left the virtio disk Windows7-KVM.qcow2 untouched.
After that i build one more vm “Virtual_Client_for_Linux_Windows_7-KVM”, whose virtio disk is Virtual_Client_for_Linux_Windows_7-KVM.qcow2.
Now added the “Windows7-KVM.qcow2” to my new virtual machine through virt-manager, but once virtual machine boots up, am not able to see the newly added “Windows7-KVM-qcow2”.
Below is the xml configuration of new vritual machine “Virtual_Client_for_Linux_Windows_7-KVM” for two disk:
<disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/var/lib/libvirt/images/Virtual_Client_for_Linux_Windows_7-KVM.qcow2'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/var/lib/libvirt/images/Windows7-KVM.qcow2'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </disk>Could you let me know, why its not detecting new disk.
-
Sorry. I won’t be able to help with this as I haven’t used Windows in long time.
-
Features
- Server Setup & Management
- Site Creation & Management
- Create WP Cloud Sites
- Speed & Caching
- Firewall Protection
- Backups & Recovery
- Logs & Monitoring
- Deployments & Developer Tools
- Team Access & User Permissions
Useful Links
Product
Other Products
Subscribe for curated product updates, tips, and announcements.
"*" indicates required fields
Phone
This field is for validation purposes and should be left unchanged.
Email*
SIGN ME UP
Δ
© rtCamp, since 2009. All rights reserved.