×
OpenVZ Virtualization
Blog Containers Virtualization

OpenVZ Virtualization

In this blog, we will share an overview of OpenVZ 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 secure, isolated Linux container.

​Each container performs and executes exactly like a stand-alone server; a container can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files. This way you use the resources more efficient

OpenVz is 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, 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 is actually requires both the host and guest OS to be running Linux. Because OpenVZ uses a single patche Linux kernel, but since it doesn’t have the overhead accompanied with 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.

Pros

*  Container style virtualization, shared kernel with the host-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 that don’t have special requirements-Less overhead

Cons

* OS templates only, there is no option to manual install your OS

* Not complete virtualization; all operating systems share one kernel.

* Not all kernel modules 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 OpenVZ environment

Here CTID representing the ID of a container (VPS – Virtual Private Server).

1.    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. Command to list running and stopped VPSs in an 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. To start a VPS

# vzctl start CTID

Example:-

# vzctl start 120

 

4. To stop or shutdown a VPS

# vzctl stop CTID

Example:-

# vzctl stop 120

 

5. To view the status of a VPS

# vzctl status CTID

Example:-

# vzctl status 120
CTID 116 exist unmounted down

 

6. To restart a VPS

# vzctl restart CTID

Example:-

# vzctl restart 120

 

7. Creating a container in 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.To enter a VPS

# vzctl enter CTID

Example:-

# vzctl enter 126
 entered into CT 126

 

9. Delete a container

# vzctl destroy CTID

10. Suspending a container

# vzctl suspend CTID

11. Set hostname for a Server

# vzctl set CTID --hostname New_hostname --save

12. Add new IP to VPS

# vzctl set CTID --ipadd xx.xx.xx.xx --save

13. Delete IP from VPS

# vzctl set CTID --ipdel xx.xx.xx.xx --save

14. Reset 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. Executes 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. 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

        

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.