.. _Supplementary Tools:

Supplementary Tools
-------------------

.. _pcompact:

pcompact
~~~~~~~~

Utility to compact containers by removing unused blocks from their virtual disks. By compacting virtual disks, you can increase free disk space on the physical server.

::

    pcompact [-v] [-n] [-s] [-t <timeout>[s|m|h]

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``-v``                              | Increase the command output verbosity. Multiple ``-v`` options can be specified to produce a more verbose |
|                                     | output.                                                                                                   |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-n``                              | Display the actions the command will execute but do not actually compact the disks.                       |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-s``                              | Stop the command execution after compacting the first virtual disk.                                       |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-t <timeout>[s|m|h]``             | Terminate the command after the specified timeout, in seconds (default), minutes or hours.                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache:

pfcache
~~~~~~~

Memory and IOPS deduplication management utility that enables/disables caching for container directories and files, verifies cache integrity, checks containers for cache errors, and purges the cache if needed.

.. note:: The utility does not support additional disks attached to container.

::

    pfcache <command> {<file>|<dir> [<options>]

**Subcommands**

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``mark``                            | Enables caching of the specified files, directories or subdirectories in containers.                      |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``unmark``                          | Disables caching of the specified files, directories or subdirectories in containers.                     |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``purge``                           | Frees up space in the memory and IOPS deduplication cache image.                                          |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``verify``                          | Verifies the integrity of the specified mounted memory and IOPS deduplication cache and deletes corrupted |
|                                     | files.                                                                                                    |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``check``                           | Checks for and fixes memory and IOPS deduplication cache errors in the specified container root           |
|                                     | directory.                                                                                                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``stat``                            | Displays inodes summary for a running container.                                                          |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``dump``                            | In addition to the summary provided by stat, shows detailed information on PFCache inodes of a running    |
|                                     | container. If no options are specified, outputs full information on checksummed peer inodes.              |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache check:

pfcache check
^^^^^^^^^^^^^

Checks for and fixes memory and IOPS deduplication cache errors in the specified container root directory.

::

    pfcache check <dir> [--dry-run]

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<dir>``                           | Container root directory.                                                                                 |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--dry-run``                       | Report errors but do not make changes to the file system.                                                 |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache dump:

pfcache dump
^^^^^^^^^^^^

In addition to the summary provided by stat, shows detailed information on PFCache inodes of a running container. If no options are specified, outputs full information on checksummed peer inodes.

::

    pfcache dump <dir> [--csummed{brvbar} -a, --all {brvbar} <csum>] [--column <col> [...]]

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<dir>``                           | Container root directory.                                                                                 |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--csummed``                       | Outputs information on checksummed inodes.                                                                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-a, --all``                       | Outputs information on all inodes.                                                                        |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``<csum>``                          | Outputs information on inodes with the specified checksum.                                                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--column <col> […]``              | Displays only the chosen column(s). ``<col>`` can be:                                                     |
|                                     |                                                                                                           |
|                                     | -  ``a`` - All                                                                                            |
|                                     |                                                                                                           |
|                                     | -  ``h`` - File handle                                                                                    |
|                                     |                                                                                                           |
|                                     | -  ``p`` - Page cache size, pages                                                                         |
|                                     |                                                                                                           |
|                                     | -  ``c`` - Checksum                                                                                       |
|                                     |                                                                                                           |
|                                     | -  ``f`` - Filter state                                                                                   |
|                                     |                                                                                                           |
|                                     | -  ``s`` - File size, bytes                                                                               |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache mark, unmark:

pfcache mark, unmark
^^^^^^^^^^^^^^^^^^^^

Enables or disables caching of the specified files, directories or subdirectories in containers.

::

    pfcache mark <file>
    pfcache mark <dir> [<subdir> [...]] [--recursive]
    pfcache unmark <file>
    pfcache unmark <dir> [<subdir> [...]] [--recursive]

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<file>``                          | File to enable/disable caching of.                                                                        |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``<dir>``                           | Directory to enable/disable caching of.                                                                   |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``<subdir>``                        | Subdirectory to enable/disable caching of.                                                                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--recursive``                     | Process directory’s or subdirectory’s current contents.                                                   |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache purge:

pfcache purge
^^^^^^^^^^^^^

Frees up space in the memory and IOPS deduplication cache image. If no options are specified, purges entire cache.

::

    pfcache purge <cache_dir> [--unused | --size <size> | --expire <date>]

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<cache_dir>``                     | Memory and IOPS deduplication cache image location.                                                       |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--unused``                        | Remove only files unused at the moment.                                                                   |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--size <size>``                   | Attempt to free ``size`` bytes in the memory and IOPS deduplication cache image.                          |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--expire <date>``                 | Remove files accessed before the specified date. A date can be specified in the ISO 8601 format or in the |
|                                     | format defined in your system locale, with optional hours, minutes, and seconds. Examples:                |
|                                     |                                                                                                           |
|                                     | -  ``05/21/12 [09:50[:33]]``                                                                              |
|                                     |                                                                                                           |
|                                     | -  ``2012-05-21 [09:50[:33]]``                                                                            |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache stat:

pfcache stat
^^^^^^^^^^^^

Displays a summary of all files in the specified filesystem which have been accessed recently or are being accessed now.

::

    pfcache stat <dir>

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<dir>``                           | Container root directory.                                                                                 |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

**Displayed Information**

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``csums``                           | The number of checksummed files and their percentage in the total number of files fetched by the command. |
|                                     |                                                                                                           |
|                                     | .. note:: Only checksummed files can be cached.                                                           |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``inodes``                          | The number of files which have been accessed recently or are being accessed now.                          |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``size``                            | The size of the files, in kilobytes.                                                                      |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``RAM``                             | Memory used by the files, in kilobytes.                                                                   |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``fetched``                         | The number of files fetched by the command.                                                               |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``uncached``                        | The number of files only in container’s private area.                                                     |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``cached``                          | The number of files which have copies in the PFCache area and their percentage in **fetched**.            |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _pfcache verify:

pfcache verify
^^^^^^^^^^^^^^

Verifies the integrity of the specified mounted memory and IOPS deduplication cache and deletes corrupt files.

::

    pfcache verify <cache_dir>

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``<cache_dir>``                     | Memory and IOPS deduplication cache image location.                                                       |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _prl_disk_tool:

prl_disk_tool
~~~~~~~~~~~~~~~

The ``prl_disk_tool`` utility is used to manage virtual hard disk drives.

.. _prl_disk_tool compact:

prl_disk_tool compact
^^^^^^^^^^^^^^^^^^^^^^^

Removes all empty blocks from the expanding virtual disk to reduce its size on the physical hard disk. The virtual disk must be formatted to NTFS, ext2/ext3/ext4, btrfs, or xfs.

::

    prl_disk_tool compact --hdd <disk_path> [--force]
    prl_disk_tool compact -i, --info --hdd <disk_path>

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``--hdd <disk_path>``               | Full path to the virtual disk.                                                                            |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--force``                         | Forces the compacting operation for suspended virtual disks.                                              |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-i, --info``                      | Do not compact the virtual disk; just display the information about the size the disk  will have after    |
|                                     | compacting.                                                                                               |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _prl_disk_tool merge:

prl_disk_tool merge
^^^^^^^^^^^^^^^^^^^^^

Merges all snapshots of the virtual hard disk.

::

    prl_disk_tool merge --hdd <disk_path>

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``--hdd <disk_path>``               | Full path to the virtual disk.                                                                            |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _prl_disk_tool resize:

prl_disk_tool resize
^^^^^^^^^^^^^^^^^^^^^^

Changes the capacity of the specified virtual disk. During resizing, all data present on the disk volumes are left intact. You can also resize the last partition using the ``--resize_partition`` option. The supported file systems are NTFS, ext2/ext3/ext4, btrfs, or xfs.

::

    prl_disk_tool resize --size <size>[K|M|G|T] [--resize_partition] --hdd <disk_path>
                         [--force]
    prl_disk_tool resize -i, --info --hdd <disk_path>

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``--size``                          | New size of the virtual disk. It can be set either in kilobytes (``K``), megabytes (``M``, default),      |
|                                     | gigabytes (``G``), or terabytes (``T``).                                                                  |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--resize_partition``              | Resizes the last partition of the specified virtual disk.                                                 |
|                                     |                                                                                                           |
|                                     | .. note:: You cannot reduce XFS filesystems (the default choice for CentOS 7 and Red Hat Enterprise       |
|                                     |     Linux 7).                                                                                             |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--hdd <disk_path>``               | Full path to the virtual disk.                                                                            |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``--force``                         | Forces the resizing operation for suspended virtual disks.                                                |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-i, --info``                      | Do not resize the virtual disk; just show the size the disk will have after resizing.                     |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

.. _vzpid:

vzpid
~~~~~

This utility prints the ID of the container where the process is running.

::

    vzpid <pid> [...]

Multiple process IDs can be specified as arguments.

.. _vzps, vztop:

vzps, vztop
~~~~~~~~~~~

These two utilities can be run on the server just as the standard Linux ``ps`` and ``htop`` utilities. For information on the ``ps`` and ``htop`` utilities, consult their man pages. The ``vzps`` and ``vztop`` utilities provide certain additional functionality related to monitoring separate containers running on the server.

The ``vzps`` utility has the following functionality added: the ``-E <CT_name>`` command-line switch can be used to show only the processes running inside the container with the specified ID.

The ``vztop`` utility has the **CTID** column added to display the container UUID where a particular process is running  (``0`` stands for the server itself).

.. _vzsplit:

vzsplit
~~~~~~~

This utility is used to generate a sample container configuration file with a set of system resource control parameters.

::

    vzsplit [-n <num>] [-f <sample_name>] [-s <swap_size>]

This utility is used for dividing the server into equal parts. It generates a full set of containers system resource control parameters based on the total physical memory of the server it runs on and the number of containers the server shall be able to run even if the given number of containers consume all allowed resources.

Without any option the utility prompts for the desired number of containers and outputs the resulting resource control parameters to the screen.

+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| Name                                | Description                                                                                               |
+=====================================+===========================================================================================================+
| ``-n <num>``                        | Desired number of containers to be simultaneously run on the server.                                      |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-f <sample_name>``                | Name of the sample configuration to create.                                                               |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+
| ``-s <swap_size>``                  | Size of the swap file on the server. It is recommended to specify the swap size to be taken into account  |
|                                     | when the utility generates sample configurations.                                                         |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------+

The resulting sample configuration will be created in the ``/etc/vz/conf`` directory. The file name will be ``ve-<sample_name>.conf-sample``. Now you can pass ``<sample_name>`` as an argument to the ``--config`` option of the ``prlctl create`` command. If a sample with this name already exists, the utility will output an error message and will not overwrite the existing configuration.
