Editing Ploop/Getting started
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | |||
− | |||
This article describes how to use container-in-a-file technology aka [[ploop]] | This article describes how to use container-in-a-file technology aka [[ploop]] | ||
− | == Requirements == | + | == Requirements == |
− | + | * OpenVZ kernel 042stab052.8 or later | |
− | + | * vzctl 3.1 or later | |
+ | * ploop-lib 1.1 or later | ||
− | + | == Making a CT on ploop == | |
− | |||
− | |||
− | |||
− | == | + | === Global configuration === |
− | |||
− | |||
− | |||
In global VZ configuration file [[Man/vz.conf.5|/etc/vz/vz.conf]], set | In global VZ configuration file [[Man/vz.conf.5|/etc/vz/vz.conf]], set | ||
− | + | VE_LAYOUT=ploop | |
− | VE_LAYOUT=ploop | ||
− | |||
This means that all new containers you will create will have ploop layout by default. | 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: | You don't have to set this option if you don't want ploop to be default. Alternatively, you can: | ||
− | |||
* use <code>--layout</code> option of <code>vzctl create</code> command; | * use <code>--layout</code> option of <code>vzctl create</code> command; | ||
* convert existing container to ploop. | * convert existing container to ploop. | ||
− | === Creating a new CT === | + | === Creating a new CT === |
− | |||
To create a new container on ploop, use: | To create a new container on ploop, use: | ||
− | + | vzctl create ''CTID'' [--layout ploop] [--diskspace ''nnn''G] | |
− | vzctl create ''CTID'' [--layout ploop] [--diskspace ''nnn''G | ||
− | |||
# You can omit <code>--layout</code> option if you have set <code>VE_LAYOUT=ploop</code> in {{Man|vz.conf|5}} | # You can omit <code>--layout</code> option if you have set <code>VE_LAYOUT=ploop</code> in {{Man|vz.conf|5}} | ||
# You can specify initial file system size using <code>--diskspace</code> option (example: 10G for 10 gigabytes) | # You can specify initial file system size using <code>--diskspace</code> option (example: 10G for 10 gigabytes) | ||
# If <code>--diskspace</code> is not specified, the size defaults to DISKSPACE limit value in sample CT config used | # If <code>--diskspace</code> is not specified, the size defaults to DISKSPACE limit value in sample CT config used | ||
− | |||
− | === Converting an existing CT === | + | === 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: | |
− | 1. | + | vzctl set ''CTID'' --diskspace 10G --save |
− | vzctl | ||
− | + | 2. Convert: | |
− | 2 | ||
− | |||
− | |||
− | |||
− | |||
vzctl convert ''CTID'' | 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. | |
− | + | {{Note|resize is potentially dangerous operation, backup is recommended to have before you proceed.}} | |
− | |||
− | + | To resize a ploop CT image (either online or offline), use | |
− | To resize a ploop CT image, use | ||
− | + | vzctl set ''CTID'' --diskspace ''nnn''G --save | |
− | vzctl set ''CTID'' --diskspace ''nnn''G --save | ||
− | |||
Note that | Note that | ||
− | |||
* there is no need to specify two values for diskspace (unlike simfs, there is no soft and hard quota). | * 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 | + | * 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 {{Man|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 usage, and the fields '''diskspace.s''' and '''diskspace.h''' are showing the filesystem size (or disk space quotas, for simfs case). | |
− | The field ''' | ||
− | + | vzlist -o smart_ctid,dspace.u | |
− | |||
− | + | == 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 | 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 | |
− | vzctl set ''CTID'' --quotaugidlimit 1000 --save | ||
− | |||
Note that: | Note that: | ||
− | * unlike with simfs, | + | * unlike with simfs, ''--quotaugidlimit'' argument can be any non-zero value; |
− | * enabling or disabling in-container disk quotas requires a container restart, so you | + | * enabling or disabling in-container disk quotas requires a container restart, so you can use vzctl's '''--setmode''' option. |
− | |||
See {{Man|vzctl|8}} for more details. | See {{Man|vzctl|8}} for more details. | ||
− | == See also == | + | == See also == |
− | |||
* [[Ploop]] | * [[Ploop]] | ||
− | |||
− | |||
* {{Man|vz.conf|5}} | * {{Man|vz.conf|5}} | ||
* {{Man|vzctl|8}} | * {{Man|vzctl|8}} | ||
− | |||
− | |||
− | |||
− |