3.4. Supplementary Tools

3.4.1. c2v-convert

The c2v-convert tool converts a Virtuozzo Hybrid Server 7 system container to a virtual machine.

Find below a list of options you can use when running the c2v-convert command.

c2v-convert [-h] [--version] [-q] [-y] [-v] [-b] [--timeout TIMEOUT]
            [--swap SWAP] [--target-state {keep,start,stop}] [--log LOG]
            [--temp TEMP] [-f FROM_FILE] [ct [ct ...]]

Name

Description

ct

The name of the container to be converted to a virtual machine.

-h, --help

Provides a list of flags used with the c2v-convert command.

--version

Specifies the program’s version number.

-q, --quiet

Skips the confirmation prompt and suppresses the output. Useful when calling from a script.

-y, --yes

The system automatically selects Y for all requests. The -y option assumes Ask me later for data collection by CEP.

-v, --verbose

The verbose mode provides detailed processing information.

-b, --batch_log

Creates a batch log file that provides log records for the containers subject to conversion.

--timeout TIMEOUT

The operation timeout in minutes [5..60]. By default, it is 30 minutes.

--swap SWAP

The swap size in the target virtual machine in MB. The default value is 2,048 MB.

--target-state {keep,start,stop}

This option specifies the desired target state of virtual machine(s) after conversion:

1. keep—The resulting virtual machine(s) will keep the state of the converted container. If the container started before the conversion, the resulting virtual machine will be started. If the container stopped before the conversion, its state will remain stop.

2. stop—The resulting virtual machine(s) will be stopped, regardless of the container’s state prior to the conversion.

3. start—The resulting virtual machine(s) will be started, regardless of the container’s state before the conversion.

By default, the value of this option is keep.

--log LOG

The path to the directory to store log files.

--temp TEMP

The path to the directory to store temporary files. By default, it is /vz/tmp.

-f FROM_FILE, --from-file FROM_FILE

The path to the batch file.

For more information, refer to Converting Containers to Virtual Machines with the c2v-convert Tool.

3.4.2. 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.

3.4.3. 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.

3.4.3.1. 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.

3.4.3.2. 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

3.4.3.3. 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.

3.4.3.4. 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]]

3.4.3.5. pfcache stat

Displays a summary of all files in the specified file system 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.

3.4.3.6. 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.

3.4.3.7. Resizing pfcache

The default pfcache size limit is 10 gigabytes (GB). If the required pfcache size exceeds the default limit on the production host, the administrator must increase it. There is no single recommended pfcache size, as it depends on the workloads in containers. Thus, it is only required to expand the pfcache size when there is no space.

To add more space to pfcache:

  1. Check space availability on the /vz partition:

    # df -h /vz
    
  2. Resize the pfcache ploop device to a greater value by specifying its new full size:

    # ploop resize -s 50G /vz/pfcache.hdd/DiskDescriptor.xml
    

Note

50G is an example. Specify smaller or greater values depending on the current pfcache size and the amount of space you want to add.

3.4.4. prl_disk_tool

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

3.4.4.1. 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.

3.4.4.2. 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.

3.4.4.3. 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 [--units <K|M|G|T>] --hdd <disk_path>

Name

Description

--size

The new size of the virtual disk. It can be set 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 file systems (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.

--units

Displays the disk size in kilobytes (K), megabytes (M, default), gigabytes (G), or terabytes (T).

3.4.5. vzpid

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

vzpid <pid> [...]

Multiple process IDs can be specified as arguments.

3.4.6. 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).

3.4.7. 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.