Changes

Jump to: navigation, search

Ploop/readme

304 bytes removed, 15:19, 10 March 2021
m
fixed some typos
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 Load modules == 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 sizeequal to 1GB. These commands succeed only if the file <code>/ploop.image</code> didn'texist at the time of running "<code>ploop init</code>".
== Load modules ==
Further ploop commands assume that all necessary modules are loaded:
# modprobe pfmt_raw
# modprobe pio_direct
 
It's not always required to load both <code>pfmt_ploop1</code> (support of ploop1 format) and
plans to snapshot it, <code>pfmt_ploop1</code> can be omitted.
== Create device Initialize image file ==
# mknod /dev/ploop0 b 182 0
This example above uses 0 as minor numberIn-kernel ploop operates on image files of "<code>raw</code>" or "<code>ploop1</code>" format. In practice, it can An image file should be any multiplecreated and initialized (entirely in user-space)of 16 before asking in 0..1048575 range: 0, 16, 32, 48, etc-kernel ploop to start using it.
Other minors (not multiple of 16) are reserved for partitions. E.g. if primaryTo just create and initialize a ploop image file with a GPT partition number 1 is created on <code>/dev/ploop0</code>, <code>/dev/ploop0p1</code> will have minorequal to 1.table and an ext4 filesystem inside:
== Bind # ploop to init -s 1g -t ext4 /ploop.image file ==
Assuming that steps 2where <code>/ploop.image</code> is full path to new image file and 1g is block-4 were done, device sizeequal to 1GB. This command succeed only if the file <code>/ploop.image</code> didn'texist at the following commands are used to time of running "mount<code>ploop init</code>"ploop device over image file.
For ploop1 format:== Mount ==
# ploop Assuming that previous steps were done, the following command is used to "mount -f ploop1 -d /dev/ploop0 /"ploopdevice over image file.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/toit (e.g. with "dd"), manipulate partition table on it (with "fdisk"<code>parted</code>, since ploop uses GUID Partition Table, or GPT), formatit 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.
=== Offline merge ===
ploop has no heruistic heuristic about determining raw/ploop1 format of image file. So,
in case of offline merge, user should specify the format of base_delta
explicitly. If it's ploop1, merge command looks like:
# ploop merge /ploop-d2.image /ploop-d1.image /ploop-d.image /ploop.image
 
This will merge /ploop-d2.image, /ploop-d1.image and /ploop-d.image into
/ploop.image.
 
When merge completed, source deltas can be deleted because all data that
was present in them has been copied to destination delta.
 
For raw format, "-f raw" should be added as option. E.g.:
In this case "ploop copy" on node02 will write data to standard output
in some special binary format and "ploop copy" on node01 will read data
from stndard standard input, parse that special format and store data in
/home/ploop1.image ("-s" stands for "source", "-d" stands for "destination").
This should work if standard output of node02 and standard input of node01
== Grow ploop device ==
"ploop grow" command is to extend image file as neccessary necessary (offline or online)and propogate propagate new block-device size to linux kernel (in online case).
=== Offline grow ===
=== Online grow ===
Assuming that /dev/ploop0 is runnung running ploop device, the command:
# ploop grow -s 32g -d /dev/ploop0
will re-arrange underlying image file, update internal kernel ploop structures
and propogate propagate changes to linux kernel making ploop device 32GB size long.
If user had ext4 formatted and mounted on /dev/ploop0, ext4 fs can be extended
someone mounted ext4 on ploop device w/o balloon_ino option, then created
empty balloon file there, found out its inode number and saved it for the
future use).
Currently, only online ballooning is supported. The following command performs
mounted to.
If balloon file was empty, the command above simply iflates inflates it to become
1GB size. If it was non-empty but smaller than 1GB, that command extends it
to given size (1GB). If it was non-empty but larger that 1GB, that
# ploop balloon status -d /dev/ploop0 -m /mnt_ploop
will report current in-kernel status of maintainance maintenance like "merge in progress",
"grow in progress", "ballooning started", etc. This is useful because on the
one hand balloon operation can't be performed while merge or grow is in
# ploop balloon clear -d /dev/ploop0 -m /mnt_ploop
will flush stale in-kernel "BALLOON" state of maintainancemaintenance. This is useful if
previous "ploop balloon" died early leaving in-kernel ploop locked.
user monitors exit status of ploop commands he/she runs in some way. If
user issued "ploop balloon change" and it was killed in the middle, the user
knows that it didn't complete with zero exit status. Then user shoud should inquirecurrent maintainance maintenance state with "ploop balloon status" command, and, if it
reported "FBLOAD" or "RELOC", the user should use "ploop balloon complete"
before proceeding with any other maintainance maintenance operations (shanphsotsnapshot, merge,
grow, balloon).
will check whether existent balloon file was properly processed. This is useful
if previous "ploop balloon" was interrupted, but "ploop balloon status"
reports "OFF" or "BALLOON" maintainance maintenance state. In this case it's possible
that balloon file was inflated but no further processing happened.
This command does essentially the same as "ploop balloon change" but w/o
inflating balloon.
 
== See also ==
 
* [[Ploop]]
* {{Man|ploop|8}}
 
[[Category: Storage]]

Navigation menu