Bobcares

How to change OpenVZ containers’ default directory

by | Oct 15, 2021

Change OpenVZ containers default directory like a pro. Our Support Engineers offer an easy solution for this seemingly simple issue.

Changing the default directory of OpenVZ containers in child’s play for the Support Team at Bobcares. Come find out how they get the job done.

About changing OpenVZ containers default directory

Changing the default directory of future OpenVZ containers cannot be done via the SolusVM interface. Fortunately, our Support Team has come up with a solution via OpenVZ node.

However, it is a good idea to remember that there are a few limitations to manually changing the default directory of future OpenVZ containers. For instance, you will not be able to:

  • Create custom templates using Create Template function.
  • Migrate containers that are not at the default location.
  • Cannot backup containers via AutoFTP Backup.

How to manually change OpenVZ containers default directory

  1. First, connect to SolusVM OpenVZ node via SSH.
  2. Then, change the default location of future containers by executing the following script:
    # curl -o svmmovevz.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/svmmovevz.sh && sh svmmovevz.sh

Another way to get the job done is by:

  1. First, connect to SolusVM OpenVZ node via SSH.
  2. Then, our Support Techs suggest taking a backup of the /etc/vz/vz.conf with the following command:
    # cp -a /etc/vz/vz.conf /root/
  3. After that, optn the /etc/vz/vz.conf using a text editor and change the directory path to the ones you prefer with the following commands:
    LOCKDIR=/vz/lock
    DUMPDIR=/vz/dump
    VE_ROOT=/vz/root/$VEID
    VE_PRIVATE=/vz/private/$VEID

    For instance:

    LOCKDIR=/home/vz/lock
    DUMPDIR=/home/vz/dump
    VE_ROOT=/home/vz/root/$VEID
    VE_PRIVATE=/home/vz/private/$VEID

    Remember not to change the TEMPLATE location since /vz/template is hardcoded in SolusVM.

  4. Then, create the required directories in the new location and set the required permissions:
    # mkdir -p /home/vz/{root,private,dump,lock}
    # chmod 700 /home/vz/private/ /home/vz/root/
    # ls -l /home/vz/
    drwxr-xr-x 2 root root 4096 June 30 06:06 dump
    drwxr-xr-x 2 root root 4096 June 30 06:06 lock
    drwx------ 2 root root 4096 June 30 06:06 private
    drwx------ 2 root root 4096 June 30 06:06 root

[Need help with Server Management? We are open 24/7.]

Conclusion

To sum up, we learned how to manually change the default directory under the guidance of the skilled Support Engineers at Bobcares.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.