Set I/O Priority for Proxmox/ OpenVZ Containers
Category : How-to
Since the 2.6.18-028stable021 kernel, it has been possible to set the I/O priority of an OpenVZ container. It is not currently possible to set any I/O limits for containers, only the priority. If you require I/O limits you should use KVM.
The higher the priority is for a container, the more time the container will have for using disks. You can choose between 0 – 7 inclusive, the default value is 4. The higher the value you use, the more I/O time your container will receive. Remember, as this is a priority system each container setting is relative to another. For example, if you set all your containers to priority 7, they will still receive the same amount of I/O time each.
To set the I/O priority of an OpenZV container, login to the host using the console and use the below command.
vzctl set [VM ID] --ioprio [Priority] --save
Replace [VM ID] with the ID of the container you would like to modify, and replace [Priority] with the priority value to use between 0 and 7. The below example sets the priority of container 200 to 7.
vzctl set 200 --ioprio 7 --save
You can also edit the config file directly. In Proxmox this is saved in /etc/pve/openvz/[VMID].conf
Add, or change the existing entry in the conf file to: IOPRIO=”[Priority]”
You will need to reboot the container for the changes to take effect.