This blog aims to guide you with an overview of OpenVZ virtualization and its basic operations. So, what are waiting for? come let’s dive into the technological world of virtualization.
What is OpenVZ Virtualization?
OpenVZ Virtualization is an operating-system-level server technology that’s actually based on the Linux kernel and OS. OS-level virtualization means many basic components exist once on the machine and are used by all guests (like the identical kernel). That means that each container shares the same underlying OS but still operates as a secure, isolated Linux container.
Each container performs and executes exactly like a stand-alone server; a container can be rebooted independently and has root access, users, IP addresses, memory, processes, files, applications, system libraries, and configuration files. This way you use the resources more efficient
OpenVZ is a Linux-based virtualization platform, it can only run Linux-based operating systems such as Centos, Fedora, Debian…etc. One disadvantage of OpenVZ Virtualization is, that users are not able to do any kernel modifications. All virtual servers have to get along with the kernel version the host runs on.
It actually requires both the host and guest OS to be running Linux. Because OpenVZ uses a single patch Linux kernel, but since it doesn’t have the overhead accompanied by legitimate hypervisors it’s super-fast and extremely efficient. However, because it doesn’t have the overhead of a true hypervisor it is very fast and efficient.
Advantages of OpenVZ virtualization:
- Container style virtualization, shared kernel with better pricing since provider can oversell.
- A little bit better performance to KVM, since there is no additional virtualization layer between the host and your VPS, which means that there is basically no overhead on assigned CPU, memory, and disk resources.
- A very low memory footprint, since the OS shares the kernel with the OS. This makes OpenVZ a great choice for VPSes with a low amount of memory.
- OpenVZ is usually a good choice for anyone who doesn’t have special requirements overhead.
Disadvantages of OpenVZ Virtualization
- OS templates only, there is no option to manually install your OS
- Not complete virtualization; all operating systems share one kernel.
- Not all kernel modules were available.
- As with all virtualization techniques, the CPU and network port are shared, which are shared among all VPSes on this node.
Basic operations in the OpenVZ environment
Here CTID represents the ID of a container (VPS – Virtual Private Server).
1. Here is the command to list the running VPSs in a node
#vzlist
Example
# vzlist
CTID NPROC STATUS IP_ADDR HOSTNAME
116 114 running xx.xx.xx.xx serverx.test.com
127 46 running xx.xx.xx.xx servery.test.com
138 83 running xx.xx.xx.xx serverz.test.com
129 86 running xx.xx.xx.xx serverq.test.com
2. Here is the command to list running and stopped VPSs in a node
#vzlist -a
Example
#vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
116 114 running xx.xx.xx.xx serverx.test1.com
127 46 running xx.xx.xx.xx servery.test2.com
138 83 running xx.xx.xx.xx serverz.test3.com
129 86 running xx.xx.xx.xx serverp.test4.com
110 – stopped xx.xx.xx.xx serverq.test5.com
3. Here is the command to start a VPS
# vzctl start CTID
Example
# vzctl start 120
4. Command to stop or shutdown a VPS
# vzctl stop CTID
Example
# vzctl stop 120
5. Command to view the status of a VPS
# vzctl status CTID
Example
# vzctl status 120
CTID 116 exists unmounted down
6. Command to restart a VPS
# vzctl restart CTID
Example
# vzctl restart 120
7. In order to create a container in the node
# vzctl create CTID –ostemplate osname
# vzctl set CTID –ipadd x.x.x.x –save
Here CTID is the numeric ID for the container; osname is the name of the OS template for the container, x.x.x.x is the IP address to be assigned to the container.
8. In order to enter a VPS
# vzctl enter CTID
Example
# vzctl enter 126
entered into CT 126
9. For Deleting a container
# vzctl destroy CTID
10. For Suspending a container
# vzctl suspend CTID
11. Command for Setting up a hostname for a Server
# vzctl set CTID –hostname New_hostname –save
12. Command to add new IP to VPS
# vzctl set CTID –ipadd xx.xx.xx.xx –save
13. Command to Delete IP from VPS
# vzctl set CTID –ipdel xx.xx.xx.xx –save
14. Command to reset the root password of a VPS
#vzctl set CTID –userpasswd root:new_password –save
15. To add NameServer IPs to VPS
#vzctl set CTID –nameserver xx.xx.xx.xx –save
16. Executing commands for a container from node
# vzctl exec CTID command
Example
# vzctl exec 120 df -h
# vzctl exec 131 df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 120G 70G 50G 78% /
none 8.0G 4.0K 8.0G 1% /dev
none 8.0G 0 8.0G 0% /dev/shm
17. Command To check the resource usages
# vzcalc -v CTID
Example
# vzcalc -v 110
# vzcalc -v 121
Resource Current(%) Promised(%) Max(%)
Low Mem 1.28 17897827062.42 182706895112.42
Total RAM 33.79 n/a n/a
Mem + Swap 1.73 38695649865149.61 n/a
Alloc. Mem 2.95 38695649865149.61 38695649865149.61
Num. Proc 0.07 n/a 2395786836523892.00
——————————————–
Memory 35.79 38695649865149.61 2395786836523892.00
Thank you for taking the time to read our blog on “What is OpenVZ virtualization? – A simple guide.”. We hope you found the information valuable and insightful. If you find any issues with the information provided in this blog don’t hesitate to contact us (info@assistanz.com).
Optimize server speed and never lose a valuable customer again!
Our mission is to ensure that your server remains lightning-fast and protected by monitoring and maintaining it 24×7 with our experts.