分享

Improve Disk Performance With Virtio | Open Hosting, Inc | Cloud Computing KVM Hosting Server Busine

 浸心阁 2015-06-02

Improve disk performance with Virtio

Virtio disk drivers provide increased performance on virtualised systems by allowing the guest operating system to co-operate directly with the hypervisor – in effect, the drivers “know” they are running in a virtual environment, and can operate more efficiently as a result. If you have a Linux server already running on Open Hosting's cloud, this short tutorial is designed to help you optimise performance by switching your drives to Virtio block devices. Drivers for Virtio are built into most modern versions of Linux as standard, so switching disk devices over can be as simple as editing two configuration files and rebooting the server with the drives attached as virtio block devices. Editing boot settings can be daunting, so it’s important to know that any problems can be quickly and easily corrected using only a Linux LiveCD.

Step 1: Check your operating system has the virtio drivers in place

The drivers are built into all recent versions of Debian and Ubuntu, and RHEL/CentOS versions greater than 5. Most BSDs require the Virtio drivers to be explicitly installed. You can run the following command to check if your Linux kernel has the correct drivers:

# modprobe virtio_blk

# grep virtblk /proc/devices

Note that distributions based on the RHEL 5.x tree do not have these drivers available at boot. If you are using one of these, you must run the following command in order to create a new initramdisk:

# mkinitrd --with virtio --with virtio_blk --with virtio_net --with virtio_pci -f /boot/initrd-$(uname -r).img $(uname -r)

Step 2: Rename your disk devices within Linux

Next we need to tell Linux where to find the disks when it reboots. Whereas disks connected by IDE or SATA disks will be labelled by Linux as /dev/sda (or, in some cases, /dev/hda), Virtio disks are labeled as /dev/vda. We need to tell the operating system to look for this change when it reboots. In order to do this, we must edit two files: the bootloader configuration file, and the filesystem table. Where you find the first one of these will depend on your bootloader. If you’re using one of Open Hosting's preinstalled images, this file is found at:

/boot/extlinux.conf

If you’re not using one of our preinstalled images, you may need to know the location of your bootloader configuration file. The default GRUB2 configuration used on Ubuntu and many other current Linux distributions does not require you to make any changes. If you’re using another bootloader (such as an older version of GRUB), the procedure is essentially the same – simply change all instances of “/dev/sda” (or “/dev/hda”) to “/dev/vda”. For example, if you see an entry reading /dev/sda1, change it to /dev/vda1, and so on. Next, do exactly the same for the filesystem table. This is located in:

/etc/fstab

You may find on some versions of Linux that one or both of these files references the disk by UUID, or by logical volume instead of device name. If this is the case, you do not need to change anything in these files.

Step 3: Change your server’s disks in the Open Hosting Control Panel

Once you are happy with the above changes, shut down your server, and click ‘Edit’ to open the Server Configuration page. You will need to expand the ‘Drives’ tab to see all available options:

Change the disks to Virtio block devices as shown below:

Optionally, click ‘Configure’ to save your changes before moving on to the final step.

Step 4: Start your server

Click ‘Start’ to run your server. It should boot as normal – you are now using Virtio disks.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多