Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Ploop/readme

436 bytes removed, 02:51, 11 June 2013
updated for latest ploop tools, added notes and warnings
This document explains how to use user-space <code>ploop</code> utility for typical
use-cases.
 
{{Warning|The commands below are low-level stuff. It's better to use vzctl which has all the features in place.}}
== Getting help ==
# ploop init
 
== Initialize image file ==
 
In-kernel ploop operates on image files of "<code>raw</code>" or "<code>ploop1</code>" format.
An image file should be created and initialized (entirely in user-space)
before asking in-kernel ploop to start using it.
 
To create and initialize image file of "<code>ploop1</code>" format:
 
# ploop init -s 1g -f ploop1 /ploop.image
 
the same for "<code>raw</code>" format:
 
# ploop init -s 1g -f raw /ploop.image
 
where <code>/ploop.image</code> is full path to new image file and 1g is block-device size
equal to 1GB. These commands succeed only if the file <code>/ploop.image</code> didn't
exist at the time of running "<code>ploop init</code>".
== Load modules ==
plans to snapshot it, <code>pfmt_ploop1</code> can be omitted.
== Create device Initialize image file == In-kernel ploop operates on image files of "<code>raw</code>" or "<code>ploop1</code>" format.An image file should be created and initialized (entirely in user-space)before asking in-kernel ploop to start using it.
# mknod /dev/ploop0 b 182 0To just create and initialize a ploop image file with a GPT partition table and an ext4 filesystem inside:
This example above uses 0 as minor number. In practice, it can be any multipleof 16 in 0..1048575 range: 0, 16, 32, 48, etc # ploop init -s 1g -t ext4 /ploop.image
Other minors (not multiple of 16) are reserved for partitionswhere <code>/ploop. E.gimage</code> is full path to new image file and 1g is block-device sizeequal to 1GB. This command succeed only if primarypartition number 1 is created on the file <code>/dev/ploop0ploop.image</code>, didn'texist at the time of running "<code>/dev/ploop0p1ploop init</code> will have minorequal to 1".
== Bind ploop to image file Mount ==
Assuming that previous steps 2-4 were done, the following commands are command is used to "mount"
ploop device over image file.
For ploop1 format:  # ploop mount -f ploop1 -d /dev/ploop0 /ploop.image For raw format:  # ploop mount -f raw -d /dev/ploop0 /ploop.image
Since this point, <code>/dev/ploop0ploopXXXX</code> is operable. One can read/write any data from/to
it (e.g. with "dd"), manipulate partition table on it (with <code>parted</code>, since ploop uses GUID Partition Table, or GPT), format it with <code>mkfs.ext4</code> and mount it on some mount-point. In the other words, since
now <code>/dev/ploop0</code> can be used as any other ordinary block device.