ploop(8) | Containers | ploop(8) |
ploop - ploop device management utility
ploop init |
-s size [-f format] [-v version] [-t fstype] [-b blocksize] [-B fsblocksize] [--nolazy] delta_file |
ploop mount |
[-r] [-F] [-f format] [-b blocksize] [-d device] [-m mount_point] [-o mount_options] [-t fstype] base_delta [... top_delta] |
ploop mount |
[-r] [-F] [-d device] [-m mount_point] [-o mount_options] [-t fstype] [-u uuid] DiskDescriptor.xml |
ploop umount |
{ -d device | -m mount_point | DiskDescriptor.xml | image_file } |
ploop replace |
{ -u uuid | -l level | -o cur_image_file } [--keep-name] -i image_file DiskDescriptor.xml |
ploop resize |
-s size DiskDescriptor.xml |
ploop convert |
{ -f format | -v version } DiskDescriptor.xml |
ploop check |
[-u uuid] DiskDescriptor.xml |
ploop check |
[--force] [--hard-force] [--check] [--ro] [--silent] [--drop-inuse] [--raw] [--blocksize size] [--repair-sparse] image_file |
ploop info |
[-s] [-d] DiskDescriptor.xml |
ploop list |
[-a] |
ploop snapshot |
[-u uuid] DiskDescriptor.xml |
ploop snapshot-merge |
[-u uuid [-U uuid2] | -A] [-n new_delta] DiskDescriptor.xml |
ploop snapshot-switch |
-u uuid DiskDescriptor.xml |
ploop snapshot-delete |
-u uuid DiskDescriptor.xml |
ploop snapshot-list |
[-H] [-u uuid] [-s] [-o field[,field...]] DiskDescriptor.xml |
ploop copy |
-s device [-F stop_command] { [-d file] | [-o output_fd] [-f feedback_fd] } |
ploop copy |
-d file [-i input_fd] [-f feedback_fd] |
ploop balloon discard |
[--automount] [--to-free size] [--min-block min_size] [--defrag] DiskDescriptor.xml |
ploop restore-descriptor |
-f format [-b blocksize] disk_dir delta_file |
ploop is a kernel block device, similar to the traditional loop device (which is controlled by losetup(8)) but with more features added, such as dynamic disk space allocation, stackable images, online resize, snapshotting, and live migration helper (write tracker). This manual page describes the ploop user space tool which is used to perform various operations related to ploop devices and images.
Note that this ploop tool is not aware of container entities. Commands that have DiskDescriptor.xml as an argument work with an XML file that contains meta-information about a particular ploop device configuration: device characteristics (block size etc.), storage information (names and formats of images used for the device), snapshot information, etc. If a particular command can be used both with and without the DiskDescriptor.xml argument, it is strongly advised to use the form with DiskDescriptor.xml.
Run ploop without any options to show a short synopsss, including a list of commands.
Run ploop command to show synopsis and a short description for a particular command.
init
Create and initialize a ploop image file and a corresponding DiskDescriptor.xml file.
ploop init |
-s size [-f format] [-v version] [-t fstype] [-b blocksize] [-B fsblocksize] [--nolazy] delta_file |
mount
Assemble a ploop device from one or more delta images, start it, and optionally mount the file system residing on the device.
Two forms of this command are provided. The first one accepts a list of delta images to be used for assembling the ploop device, while the second one is using information from a DiskDescriptor.xml file. Please note that not all mount options are applicable to both forms.
ploop mount |
[-r] [-F] [-f format] [-b blocksize] [-d device] [-m mount_point] [-o mount_options] [-t fstype] base_delta [... top_delta] |
ploop mount |
[-r] [-F] [-d device] [-m mount_point] [-o mount_options] [-t fstype] [-u uuid] DiskDescriptor.xml |
umount
Unmount a ploop device. Since a mounted ploop device consists of an image (or multiple images), a device, and (optionally) a file system mounted to a directory, one can refer to any of the above entities to specify what to unmount. The recommended way is to use DiskDescriptor.xml.
ploop umount |
{ -d device | -m mount_point | DiskDescriptor.xml | image_file } |
replace
Replaces a ploop image by a different (but identical) one, on a running ploop device. Only a read-only image (e.g. a non-top one in a stacked configuration) can be replaced. An image to be replaced is specified by either one of level, UUID, or the current image file.
If a new image is not identical to the old one (i.e. its content differs) or not suitable for ploop in any other way (e.g. it is sparse, or resides on a file system not supported by ploop), the result is undefined.
ploop replace |
{ -u uuid | -l level | -o cur_image_file } [--keep-name] -i image_file DiskDescriptor.xml |
resize
Resize a ploop image. Both online (i.e. when ploop is mounted and used) and offline resize is supported, and the tool can either grow or shrink both the ploop image and the underlying file system.
ploop resize |
-s size DiskDescriptor.xml |
convert
Convert either ploop image format or version (but not both at the same time). Conversion can only be performed offline (i.e. image should not be in use).
ploop convert |
{ -f format | -v version } DiskDescriptor.xml |
check
Check the internal consistency of (and possibly repair) a ploop image (or images). Note that image(s) to be tested should not be in use.
ploop check |
[-u uuid] DiskDescriptor.xml |
Check all the images in DiskDescriptor.xml up to the one denoted by the uuid (or default top delta, if UUID is not specified). Default built-in check options are used, and the ones specified on the command line, if any, are ignored.
ploop check |
[--force] [--hard-force] [--check] [--ro] [--silent] [--drop-inuse] [--raw] [--blocksize size] [--repair-sparse] DiskDescriptor.xml | image_file |
info
ploop info |
DiskDescriptor.xml |
ploop info |
[-s] [-d] DiskDescriptor.xml |
list
ploop list |
[-a] |
Shows a list of running ploop devices (first column) and their corresponding base images. With option -a it also shows a mount point (third column).
restore-descriptor
Create DiskDescriptor.xml file suitable for delta_file and put it into disk_dir.
ploop restore-descriptor |
-f format [-b blocksize] disk_dir delta_file |
Read image header in case of ploop1 format or check raw image size and generate proper DiskDescriptor.xml file. You can specify blocksize for raw images. If it's not specified it will be chosen automatically - largest possible value between 32K and 1M. Raw image size must be aligned to blocksize.
This command works only for base images. Snapshots are not supported.
Ploop snapshots is a mechanism for creating and managing instant states of a running file system. Creating a snapshot leads to creating a new empty ploop image which is layered on top of an old one, then all writes are ending up in the top image, and reads are falling through to a lower level. There can be up to 126) stacked ploop images (or snapshots). Online snapshot merging is also supported.
Snapshots are identified by a unique UUID. A snapshot can be mounted using ploop mount -u uuid command, see above.
snapshot
Create a ploop snapshot.
ploop snapshot |
[-u uuid] DiskDescriptor.xml |
snapshot-merge
Merge a snapshot with its parent. That is, contents of the delta file corresponding to the snapshot is merged to a parent delta, then the file is removed. Parent snapshot UUID is lost (as it is replaced with the uuid specified). All snapshots having the lost one as a parent are updated to have the uuid as its parent.
ploop snapshot-merge |
[-u uuid [-U uuid2] | -A] [-n new_delta] DiskDescriptor.xml |
snapshot-switch
Switch to the specified snapshot. This operation can only be performed while ploop is not running (i.e. is unmounted). The current top delta image will be removed.
ploop snapshot-switch |
-u uuid DiskDescriptor.xml |
snapshot-delete
Delete the specified snapshot. This operation can only be performed if the specified snapshot is not active. In case snapshot doesn't have any children, it will simply be removed. In case snapshot has a single child, it will be merged to that child. Deleting a snapshot that has multiple children is currently not supported (but can be performed manually in an iterative fashion).
ploop snapshot-delete |
-u uuid DiskDescriptor.xml |
snapshot-list
List available snapshots.
ploop snapshot-list |
[-H] [-u uuid] [-s] [-o field[,field...]] DiskDescriptor.xml |
ploop copy is a mechanism of effective copying of a top ploop image with the help of build-in ploop kernel driver feature called write tracker. Write tracker is a feature that lets ploop copy to iteratively obtain a list of modified image blocks from the kernel. Two ploop copy processes are required for iterative top delta transfer. These are used by vzmigrate(8).
copy (sending)
ploop copy |
-s device [-F stop_command] { [-d file] | [-o output_fd] [-f feedback_fd] } |
This command enables the in-kernel write tracker for the specified ploop device, then sends all the data blocks from the top delta image to a pipe specified by the output_fd argument (stdout, i.e. 1 by default), supposedly read by destination ploop copy, or a file. After that, it iteratively gets the list of the modified data blocks from the kernel and sends those blocks again. After a number of iterations (or when the list is empty), it executes the stop_command (this could be vzctl stop or vzctl chkpnt) and does the last iteration of sending the modified data blocks. Finally, it checks that the data were not modified, error is returned otherwise.
If feedback_fd is specified, it is used to read back from the ploop copy receiving side. The feedback channel is currently used to wait for fdatasync(2) completion.
copy (receiving)
ploop copy |
-d file [-i input_fd] [-f feedback_fd] |
Reads the data blocks (provided by the source ploop copy) from the file descriptor input_fd (stdin, i.e. 0 by default) and writes them to the file.
If feedback_fd is specified, it is used to send status back to the ploop copy sending side.
Since there is no online shrink support in ext4 file system, ploop internally uses a technique called "ballooning" as a work around to shrink its images.
Ballooning operation consists of inflating a special balloon file (invisible for ordinary users), loading fiemap info of the inflated balloon to the kernel, relocating blocks of the image file from the tail to the space specified by fiemap info, and truncating the tail of the image file. Result is the image file of a smaller size.
However, it is quite possible that inflated balloon file will only span blocks that were never touched before. Those will look like "not allocated" space from the kernel ploop point of view. In this case nothing will be relocated and nothing truncated.
So, if balloon operation succeeded, it's only guaranteed that a user of ploop device won't be able to consume more space than the initial block device size minus the size of the inflated balloon. On the other hand, if a user of block device used a lot of space on it, then freed the significant part of used space, balloon operation will result in significant truncate of image file.
All the ploop ballooning logic is hidden from the end user, so while a number of low-level commands exist for working with ploop ballooning, those are not needed and therefore are not documented here, except for a single command.
balloon discard
In a situation when a lot of disk space were freed on an in-ploop filesystem, use ploop balloon discard to optimize the ploop image size.
ploop balloon discard |
[--automount] [--to-free size] [--min-block min_size] [--defrag] DiskDescriptor.xml |
Iteratively try to relocate and discard unused blocks from a ploop image, reducing its size.
Note that ploop device and its inner file system should be mounted. If not, one can use --automount option to automatically mount ploop for the duration of the operation.
Option --defrag can be used to run a filesystem defragmentation utility (currently e4defrag2 on ext4 only) before the main operation.
Option --to-free can be used to specify a maximum disk space to be freed. In other words, stop the process once freed space exceeded requested size. Default is 0, meaning to try to free as much space as possible.
Option --min-block can be used to specify a minimum size of an extent to free. The smallest possible extent is 1 cluster (currently 1 MB), one can specify higher value to speed up the whole discarding operation.
Note that the same functionality is available by means of vzctl compact command.
The following image formats are currently supported.
ploop exits with status 0 in case of successful execution. Any status greater than 0 signifies an error.
vzctl(8), vzmigrate(8), http://openvz.org/Ploop.
26 May 2014 | OpenVZ |