Editing Ploop/Getting started

Jump to: navigation, search

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:
 
<translate>
 
<translate>
<!--T: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 == <!--T:2-->
+
== Requirements ==
  
<!--T:3-->
 
 
The following is required for ploop to work:
 
The following is required for ploop to work:
  
<!--T:4-->
 
 
# [[Download/kernel/rhel6|RHEL6-based OpenVZ kernel]], i.e. 042stabXXX.
 
# [[Download/kernel/rhel6|RHEL6-based OpenVZ kernel]], i.e. 042stabXXX.
 
# <code>/vz</code> partition formatted as <code>ext4</code> and mounted in ordered mode, or residing on NFSv3. No other filesystem is supported.
 
# <code>/vz</code> partition formatted as <code>ext4</code> and mounted in ordered mode, or residing on NFSv3. No other filesystem is supported.
 
# ploop library and tools installed (run <code>yum install ploop</code>).
 
# ploop library and tools installed (run <code>yum install ploop</code>).
  
== Making a CT on ploop == <!--T:5-->
+
== Making a CT on ploop ==
  
=== Global configuration === <!--T:6-->
+
=== Global configuration ===
  
<!--T:7-->
 
 
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
  
  <!--T:8-->
+
  VE_LAYOUT=ploop  
VE_LAYOUT=ploop  
 
  
<!--T:9-->
 
 
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.
  
<!--T:10-->
 
 
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:
  
<!--T:11-->
 
 
* 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 === <!--T:12-->
+
=== Creating a new CT ===
  
<!--T:13-->
 
 
To create a new container on ploop, use:
 
To create a new container on ploop, use:
  
  <!--T:14-->
+
  vzctl create ''CTID'' [--layout ploop] [--diskspace ''nnn''G] [--diskinodes ''mmm'']
vzctl create ''CTID'' [--layout ploop] [--diskspace ''nnn''G] [--diskinodes ''mmm'']
 
  
<!--T:15-->
 
 
# 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)
Line 47: Line 36:
 
# If <code>--diskinodes</code> is not specified, 1 inode per 16K of disk space will be created (see [[../diskinodes/]] for more info)
 
# If <code>--diskinodes</code> is not specified, 1 inode per 16K of disk space will be created (see [[../diskinodes/]] for more info)
  
=== Converting an existing CT === <!--T:16-->
+
=== Converting an existing CT ===
  
<!--T:17-->
 
 
1. Stop the container:
 
1. Stop the container:
 
  vzctl stop ''CTID''
 
  vzctl stop ''CTID''
  
<!--T:18-->
 
 
2. Set some sane diskspace value, and reset the [[../diskinodes/]] value. New value for diskspace will be used as a size of newly created ploop image. Here is the example to set diskspace to 10 gigabytes:
 
2. Set some sane diskspace value, and reset the [[../diskinodes/]] value. New value for diskspace 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 --diskinodes 0 --save
 
  vzctl set ''CTID'' --diskspace 10G --diskinodes 0 --save
  
<!--T:19-->
 
 
3. Convert:
 
3. Convert:
 
  vzctl convert ''CTID''
 
  vzctl convert ''CTID''
  
<!--T:20-->
 
 
4. Once your CT is well tested, you can free disk space by removing files that may have remained from the old container file system in /vz/root/''CTID''. VERY CAREFULLY (and after testing your converted container) you can stop, remove old files and start container again, e.g.:
 
4. Once your CT is well tested, you can free disk space by removing files that may have remained from the old container file system in /vz/root/''CTID''. VERY CAREFULLY (and after testing your converted container) you can stop, remove old files and start container again, e.g.:
 
  vzctl stop ''CTID''
 
  vzctl stop ''CTID''
Line 67: Line 52:
 
  vzctl start ''CTID''
 
  vzctl start ''CTID''
  
== Resizing a ploop image == <!--T:21-->
+
== Resizing a ploop image ==
  
<!--T:22-->
 
 
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.
 
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.
  
<!--T:23-->
 
 
To resize a ploop CT image, use
 
To resize a ploop CT image, use
  
  <!--T:24-->
+
  vzctl set ''CTID'' --diskspace ''nnn''G --save
vzctl set ''CTID'' --diskspace ''nnn''G --save
 
  
<!--T:25-->
 
 
Note that
 
Note that
 
* resize can safely be performed online (i.e. when container is running)
 
* resize can safely be performed online (i.e. when container is running)
Line 84: Line 65:
 
* there is no way to limit or change the number of inodes available for an existing container (i.e. option <code>--diskinodes</code> is ignored); see [[../diskinodes/]] for more details
 
* there is no way to limit or change the number of inodes available for an existing container (i.e. option <code>--diskinodes</code> is ignored); see [[../diskinodes/]] for more details
  
== Showing disk space usage / limits == <!--T:26-->
+
== Showing disk space usage / limits ==
  
<!--T:27-->
 
 
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).
 
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).
  
<!--T:28-->
 
 
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 '''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).
  
<!--T:29-->
 
 
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).
 
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).
  
<!--T:30-->
 
 
Examples:
 
Examples:
  
  <!--T:31-->
+
  vzlist -o smart_name,diskspace.h,diskspace
vzlist -o smart_name,diskspace.h,diskspace
 
 
  vzlist -o smart_name,diskinodes.h,diskinodes
 
  vzlist -o smart_name,diskinodes.h,diskinodes
  
<!--T:32-->
 
 
On a lower level, same info can be obtained via '''ploop info''' command:
 
On a lower level, same info can be obtained via '''ploop info''' command:
  
  <!--T:33-->
+
  ploop info /vz/private/501/root.hdd/DiskDescriptor.xml
ploop info /vz/private/501/root.hdd/DiskDescriptor.xml
 
  
== Using disk quotas inside container == <!--T:34-->
+
== Using disk quotas inside container ==
  
<!--T:35-->
 
 
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
  
  <!--T:36-->
+
  vzctl set ''CTID'' --quotaugidlimit 1000 --save
vzctl set ''CTID'' --quotaugidlimit 1000 --save
 
  
<!--T:37-->
 
 
Note that:
 
Note that:
 
* unlike with simfs, <code>--quotaugidlimit</code> argument can be any non-zero value;
 
* unlike with simfs, <code>--quotaugidlimit</code> argument can be any non-zero value;
 
* enabling or disabling in-container disk quotas requires a container restart, so you might find <code>--setmode</code> option helpful.
 
* enabling or disabling in-container disk quotas requires a container restart, so you might find <code>--setmode</code> option helpful.
  
<!--T:38-->
 
 
See {{Man|vzctl|8}} for more details.
 
See {{Man|vzctl|8}} for more details.
  
== See also == <!--T:39-->
+
== See also ==
  
<!--T:40-->
 
 
* [[Ploop]]
 
* [[Ploop]]
 
* [[Ploop/backup]]
 
* [[Ploop/backup]]

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: