Post Date: January 23, 2021
Last Updated: November 27, 2026
Introduction
OpenVZ is a container-based virtualization technology that allows hosting providers to run multiple isolated virtual private servers (VPS) on a single physical server. Each container is allocated specific system resources, including RAM, swap memory, CPU, and disk space.
As applications grow and server workloads increase, the existing memory allocation may become insufficient, resulting in performance issues, slow application responses, or memory-related errors. In such situations, increasing the allocated RAM helps improve the performance and stability of the VPS.
In this tutorial, we will explain how to increase RAM in OpenVZ container using the vzctl command-line utility. We will walk through five simple steps, starting with identifying the container ID and stopping the VPS, followed by updating the RAM and swap allocation, restarting the container, and verifying the changes.
This guide is useful for system administrators and hosting providers who manage OpenVZ-based VPS environments.
Prerequisites
Before proceeding with the process to increase RAM in an OpenVZ container, make sure you have the following:
- Root access: SSH access to the physical server running OpenVZ with root privileges.
- OpenVZ environment: A working OpenVZ virtualization environment.
- Container ID (CT_ID): Identify the VPS container whose RAM allocation needs to be increased.
- Available server memory: Ensure that the physical server has sufficient free memory to accommodate the additional RAM allocation.
- Maintenance window: Plan a maintenance window because the container needs to be stopped and restarted during the configuration process.
- Backup: Take a backup of important VPS data before making resource configuration changes.
- Resource allocation details: Decide the required RAM and swap sizes before applying the configuration.
Note: The commands in this tutorial use the traditional OpenVZ vzctl management syntax. Make sure your OpenVZ version supports the specified RAM and swap options. Resource parameters may differ between OpenVZ versions.
How to Increase RAM in OpenVZ Container
Follow the steps below to increase RAM in an OpenVZ container using the vzctl command.
Step 1: Check the List of Running OpenVZ Containers
First, connect to the physical OpenVZ server through SSH with root privileges. Execute the following command to list all running containers.
vzlist
This command displays the list of currently running containers along with their container IDs, hostnames, IP addresses, and other details.
Identify the container ID (CT_ID) of the VPS for which you want to increase the RAM allocation.
Step 2: Stop the OpenVZ Container
Before modifying the RAM allocation, stop the target VPS container.
Use the following command:
vzctl stop <CT_ID>
For example:
vzctl stop 104
Replace 104 with your actual container ID.
Stopping the container ensures that the VPS is not running while you apply the resource configuration changes. Please schedule this operation during a maintenance window because the VPS will experience temporary downtime.
Step 3: Increase RAM and Swap Memory
Once the container has been stopped, execute the following command to increase its RAM and swap allocation.
vzctl set <CT_ID> --ram <Size> --swap <Size> --save
Example:
vzctl set 104 --ram 4096M --swap 1G --save
In this example:
104– Container ID of the target VPS.--ram 4096M– Sets the RAM allocation to 4096 MB (4 GB).--swap 1G– Sets the swap allocation to 1 GB.--save– Saves the updated configuration permanently so that the settings persist after a container restart.
Make sure that the requested memory allocation is within the physical server’s available resources and the limits supported by your OpenVZ version.
Need Help with VPS RAM Configuration?
Managing OpenVZ containers, increasing VPS RAM, and configuring server resources can sometimes require technical expertise. Our team can help you with VPS memory upgrades, OpenVZ container management, server optimization, Linux administration, and infrastructure management.
Need help managing your VPS server? Contact Pheonix Solutions for expert assistance.
Step 4: Start the Container and Check Its Status
After successfully updating the RAM and swap configuration, start the VPS container using the following command:
vzctl start <CT_ID>
For example:
vzctl start 104
To verify whether the container has started successfully, execute:
vzctl status <CT_ID>
The output should indicate that the container is running.
Step 5: Verify the RAM Allocation Inside the VPS
Finally, connect to the VPS through SSH and execute the following command to check the available memory.
free -h
This command displays the total RAM, used memory, free memory, shared memory, cache, and swap allocation in a human-readable format.
Check the Mem and Swap sections to confirm whether the updated memory allocation is reflected inside the VPS.
If the expected RAM and swap values are displayed, the configuration has been applied successfully.
Note: The actual memory visible inside the container can depend on the OpenVZ version, container resource limits, and host-level memory management. If the expected values are not displayed, check the container configuration and applicable memory limits.
Conclusion
Increasing RAM in an OpenVZ container is a straightforward process when using the vzctl command-line utility. By identifying the correct container ID, stopping the VPS, updating the RAM and swap allocation, and restarting the container, system administrators can allocate additional memory resources based on application requirements.
In this tutorial, we covered how to increase RAM in an OpenVZ container and verify the updated memory allocation using the free -h command.
Before making any resource changes, always ensure that the physical server has sufficient available memory and that the new configuration is supported by your OpenVZ version.
For professional assistance with VPS management, server administration, and virtualization solutions, contact the Pheonix Solutions team.
FAQs
1. How to increase RAM in an OpenVZ container?
You can increase RAM in an OpenVZ container using the vzctl set command. First, stop the container using vzctl stop <CT_ID>. Then execute vzctl set <CT_ID> --ram 4096M --swap 1G --save to configure 4 GB RAM and 1 GB swap. Finally, restart the container and verify the memory using free -h.
2. Which command is used to check running OpenVZ containers?
The vzlist command is used to display the list of running OpenVZ containers. It provides information such as container IDs, hostnames, IP addresses, and container status.
3. Is it necessary to stop the OpenVZ container before increasing RAM?
Yes, for the procedure described in this tutorial, you should stop the container before modifying its RAM allocation. This helps apply the configuration changes safely. It also causes temporary VPS downtime.
4. What is the purpose of the –save option in the vzctl command?
The --save option permanently saves the updated container configuration. Without saving the configuration, changes may not persist after the container is restarted.
5. How can I verify the RAM size after increasing it in OpenVZ?
Log in to the VPS through SSH and execute the following command:
free -h
This command displays the total, used, and available RAM along with swap memory in a human-readable format.
Official Documentation
- Official OpenVZ Documentation – OpenVZ virtualization documentation.
- vzctl Command Manual – Reference for vzctl commands and options.
Related Articles
How to create a container in OpenVZ server
How to restore OpenVZ / Virtuozzo 7 (Disaster Recovery – DR)
Need Assistance?
Managing OpenVZ containers, increasing VPS RAM, and configuring server resources can sometimes require additional technical expertise. Our team can help you with OpenVZ container management, VPS resource allocation, server optimization, virtualization, Linux server administration, server security, and infrastructure management.
Need assistance with your VPS server? Please feel free to contact the Pheonix Solutions team. We will be happy to assist you with your VPS management and server administration requirements.
Explore Pheonixsolutions to learn more about our hosting, cloud infrastructure, and DevOps services.
Explore our services to learn more:
