Ubuntu – Creating Containers in OpenVZ

openvzUbuntu

After using the instructions I found on http://www.unixmen.com/install-and-configure-openvz-in-ubuntu/ I installed OpenVZ on Ubuntu 14.04 LTS, which is running in WMware Workstation 10.0.3. Then I moved to http://www.unixmen.com/how-to-create-openvz-container-in-openvz/.

In the tutorial, they download CentOS 7, but because I can't use 64-bit versions under my VMware Workstation (due to an option unavailable in my BIOS), I chose to download an older, 32-bit version of CentOS. I unpacked the .tar file after download.

When I entered the command

 root@box1:/etc/vz/template/cache# vzctl create 101 --ostemplate centos-6-x86

to create the first virtual machine I get these:

Warning: CT config file already exists, not applying a default config sample.
It might lead to incomplete CT configuration, you can use --applyconfig to fix.
Error: diskspace not set (required for ploop)
Creation of container private area failed

Why do I get that error? Is there something to be done about it?

Best Answer

It seems you have somehow made an incomplete config file for CT 101, namely /etc/vz/conf/101.conf. If you're confident you have nothing important in CT 101, you can just destroy it (or manually remove /etc/vz/conf/101.conf) then try again creating CT 101.

vzctl destroy 101
vzctl create 101 --ostemplate centos-6-x86

And I must correct several misunderstandings in the site you cite.

  • You don't have to download template files by yourself. Recent vzctl create will automatically download it on behalf of you. You can specify your nearest mirror site in /etc/vz/download.conf. See vztmpl-dl manpage for details.
  • You don't have to unpack tar+gz template files. Just put as it is in /srv/vz/template/cache/ when you've bothered to download one.
  • You should always use vzctl set CTID --save to configure CT rather than directly edit its config file:

    vzctl set 101 --save --ram 256M --swap 512M --diskspace 2G:2.2G
    

    Especially regarding diskspace, any changes in a config file won't be reflected in the ploop layout.

Related Question