Open main menu

OpenVZ Virtuozzo Containers Wiki β

Ploop/Getting started

< Ploop
Revision as of 14:31, 20 September 2014 by Corradofiore (talk | contribs) (Requirements)

This article describes how to use container-in-a-file technology aka ploop

Contents

Requirements

The following is required for ploop to work:

  1. RHEL6-based OpenVZ kernel, i.e. 042stabXXX.
  2. /vz partition formatted as ext4 and mounted in ordered mode, or residing on NFS. No other filesystem is supported.
  3. ploop library and tools installed (run yum install ploop).

Making a CT on ploop

Global configuration

In global VZ configuration file /etc/vz/vz.conf, set

VE_LAYOUT=ploop 

This means that all new containers you will create will have ploop layout by default.

You don't have to set this option if you don't want ploop to be default. Alternatively, you can:

  • use --layout option of vzctl create command;
  • convert existing container to ploop.

Creating a new CT

To create a new container on ploop, use:

vzctl create CTID [--layout ploop] [--diskspace nnnG]
  1. You can omit --layout option if you have set VE_LAYOUT=ploop in vz.conf(5)
  2. You can specify initial file system size using --diskspace option (example: 10G for 10 gigabytes)
  3. If --diskspace is not specified, the size defaults to DISKSPACE limit value in sample CT config used

Converting an existing CT

1. Set some sane diskspace value (which will be used as a size of newly created ploop image). Here is the example to set diskspace to 10 gigabytes:

vzctl set CTID --diskspace 10G --save

2. Convert:

vzctl convert CTID

Resizing a ploop image

Ploop image can be resized in both directions (i.e. either shrank or grown). Ploop also supports online/live resize so you don't have to stop a CT to do resize.

To resize a ploop CT image, use

vzctl set CTID --diskspace nnnG --save

Note that

  • resize can safely be performed online (i.e. when container is running)
  • there is no need to specify two values for diskspace (unlike simfs, there is no soft and hard quota).
  • there is no way to limit or change the number of inodes available for a container (i.e. option --diskinodes is ignored)

Showing disk space usage / limits

You can use vzlist(8) to see CT disk space usage and limits in a uniform way for any containers (simfs or ploop, started or stopped).

The field diskspace is showing the current disk space usage, and the fields diskspace.s and diskspace.h are showing the filesystem size (or disk space quotas, for simfs case).

The field diskinodes is showing the current inodes usage, and the fields diskinodes.s and diskinodes.h are showing the filesystem size (or disk inodes quotas, for simfs case).

Examples:

vzlist -o smart_name,diskspace.h,diskspace
vzlist -o smart_name,diskinodes.h,diskinodes

On a lower level, same info can be obtained via ploop info command:

ploop info /vz/private/501/root.hdd/DiskDescriptor.xml

Using disk quotas inside container

If you want to use standard Linux per-user and per-group disk quota inside a container, you have to enable it using

vzctl set CTID --quotaugidlimit 1000 --save

Note that:

  • unlike with simfs, --quotaugidlimit argument can be any non-zero value;
  • enabling or disabling in-container disk quotas requires a container restart, so you can use vzctl's --setmode option.

See vzctl(8) for more details.

See also