Announcement

Collapse
No announcement yet.

Common Used OpenVZ Commands:

Collapse
X
Collapse
  •  

  • Common Used OpenVZ Commands:

    Hello Everyone,

    This article covers most commonly used OpenVZ commands that can be useful for system administrator who are using OpenVZ:

    1. To list running VPSs on the node:
    [Command ]# vzlist

    Code:
    [B]Example:[/B]
    # vzlist
          CTID      NPROC STATUS    IP_ADDR         HOSTNAME
           101        112 running   xx.xx.xx.xx  server1.24x7.com    
           102         54 running   xx.xx.xx.xx  server2.24x7.com
    2. To list all running as well as stopped VPSs on the node:
    [Command ]# vzlist -a

    Code:
    [B]Example:[/B]
    # vzlist -a
            CTID      NPROC STATUS    IP_ADDR         HOSTNAME
          CTID      NPROC STATUS    IP_ADDR         HOSTNAME
           101        112 running   xx.xx.xx.xx  server1.24x7.com    
           102         54 running   xx.xx.xx.xx  server2.24x7.com    
           103          - stopped   xx.xx.xx.xx  server3.24x7.com
    3. To start a VPS
    [Command ]# vzctl start CTID
    Code:
    [B]Example:[/B]
    # vzctl start 110
    4. To stop or shutdown a VPS
    [Command ]# vzctl stop CTID
    Code:
    [B]Example:[/B]
    # vzctl stop 110
    5. To view the status of a VPS
    [Command ]# vzctl status CTID
    Code:
    [B]Example:[/B]
    # vzctl status 110
    CTID 116 exist unmounted down
    6. To restart a VPS
    [Command ]# vzctl restart CTID
    Code:
    [B]Example:[/B]
    # vzctl restart 110
    Logging into a container
    7. To enter a VPS
    [Command ]# vzctl enter CTID
    Code:
    [B]Example:[/B]
    # vzctl enter 106
    entered into CT 106
    Suspend and delete a container
    8. To delete a container:
    [Command ]# vzctl destroy CTID

    9. To suspending a container:
    [Command ]# vzctl suspend CTID

    10. To set hostname for a Server:
    [Command ]# vzctl set CTID --hostname New_hostname --save

    11. To add new IP to VPS:
    [Command ]# vzctl set CTID --ipadd xx.xx.xx.xx --save

    12. To delete IP from the VPS
    [Command ]# vzctl set CTID --ipdel xx.xx.xx.xx --save

    13. To reset root password of the VPS:
    [Command ]# vzctl set CTID --userpasswd root:new_password --save

    14. To add nameserver IP to VPS:
    [Command ]# vzctl set CTID --nameserver xx.xx.xx.xx --save

    15. To executes command inside container from the node:
    [Command ]# vzctl exec CTID command
    Code:
    [B]Example:[/B]
    # vzctl exec 101 df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/simfs 130G 89G 27G 78% /
    none 8.0G 4.0K 8.0G 1% /dev
    none 8.0G 0 8.0G 0% /dev/shm
    16. To check the VPS resource usages:
    [Command ]# vzcalc -v CTID
    Code:
    [B]Example:[/B]
    # vzcalc -v 101
    Resource     Current(%)  Promised(%)  Max(%)
    Low Mem          1.32 343754532205.77 343754532205.77
    Total RAM       16.50        n/a        n/a
    Mem + Swap       5.61 75011961258353.81        n/a
    Alloc. Mem      28.13 75011961258353.81 75011961258353.81
    Num. Proc        0.08        n/a 3607713474246657.00
    --------------------------------------------
    Memory          28.13 75011961258353.81 3607713474246657.00
    17. To Synchronize time between OpenVZ host and guest containers:
    [Command ]# vzctl set CTID --capacity sys_timen --save







    I hope this has been informative for you and I would like to thank you for reading it.



    Last edited by Jayant R. Danech; 06-28-2019, 10:26 PM.
      Posting comments is disabled.

    Categories

    Collapse

    Latest Articles

    Collapse

    • What is Containerization? A Deep Dive into Containerization
      by Lalit_Waghulkar
      Hey there tech enthusiasts!

      Today, we're diving into the tech wonderland of containerization – a game-changer in the world of software development. So, buckle up your coding belts as we explore the ins and outs of this revolutionary technology and how it's turning the tables for developers everywhere.

      Containerization: What's the Buzz About?
      Alright, let's start with the basics. Containerization is like a digital lunchbox for your apps, keeping everything they need...
      01-10-2024, 03:08 PM
    • Enable native brute-force protection
      by Akash Gorane
      Error on Imunify 360 dashboard: Enable native brute-force protection module for Dovecot to protect against IMAP/POP3 services attacks.
      Screenshot: https://prnt.sc/ExqjW1hdfOrR

      Solution: Dovecot native brute force protection module improves stability and resolves issues that standard PAM caused in some cases The following commands can be used to control the Dovecot native module.

      Enable:
      :
      imunify360-agent config update '{"PAM": {"enable":
      ...
      02-03-2023, 06:12 PM
    • Enable native brute-force protection.
      by Akash Gorane
      Error on Imunify 360 dashboard: Enable native brute-force protection module for Dovecot to protect against IMAP/POP3 services attacks.
      Screenshot: https://prnt.sc/ExqjW1hdfOrR

      Solution: Dovecot native brute force protection module improves stability and resolves issues that standard PAM caused in some cases The following commands can be used to control the Dovecot native module.
      Enable:

      :
      imunify360-agent config update '{"PAM": {"enable":
      ...
      02-03-2023, 06:09 PM
    • Top Command
      by Akash Gorane
      [COLOR=rgba(0, 0, 0, 0.9)]'top' command is used to display dynamic real-time information about running processes in the system.[/COLOR]



      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,
      ...
      01-12-2023, 05:12 PM
    • Top Command
      by Akash Gorane
      [COLOR=rgba(0, 0, 0, 0.9)]top command is used to display dynamic real-time information about running processes in the system.[/COLOR]



      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,...
      01-12-2023, 05:05 PM
    • TOP Command
      by Akash Gorane
      #[COLOR=rgba(0, 0, 0, 0.9)] top command is used to display dynamic real-time information about running processes in the system.[/COLOR]

      -
      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,
      ...
      01-12-2023, 05:04 PM
    Working...
    X