How to change default directory for future OpenVZ containers in SolusVM?

Have more questions? Submit a request

Applicable to:

  • SolusVM

Question

How to change the default directory for all future OpenVZ containers in SolusVM?

Answer

Not possible through SolusVM interface, however it can be done manually on OpenVZ node.

Warning: the solution below should be applied on your own risk as there are following known limitations of changed container location:
- it is not possible to create custom templates through Create Template function;
- not possible to Migrate containers in not-default location;
- not possible to backup such containers through AutoFTP Backup.

  1. Connect to your SolusVM OpenVZ node over SSH.

  2. Download and execute script to change default location of all future containers:

    # curl -o svmmovevz.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/svmmovevz.sh && sh svmmovevz.sh

In case you would like to perform the change manually - use the instruction below:
  1. Connect to your SolusVM OpenVZ node over SSH.

  2. Create a backup of the configuration file /etc/vz/vz.conf:

    # cp -a /etc/vz/vz.conf /root/

  3. Open the file /etc/vz/vz.conf with a text editor and change the following directory path to the required ones:

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

    For example:

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

    Note: do not change TEMPLATE location - /vz/template is hardcoded in SolusVM.

  4. Create the necessary directories in the new location and set correct 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 May 30 06:06 dump
    drwxr-xr-x 2 root root 4096 May 30 06:06 lock
    drwx------ 2 root root 4096 May 30 06:06 private
    drwx------ 2 root root 4096 May 30 06:06 root

Additional Information

How to change the directory of existing OpenVZ containers in SolusVM?

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.