Provided by: libguestfs-tools_1.24.5-1ubuntu0.1_amd64
НАЗВА
virt-sparsify - Make a virtual machine disk sparse
КОРОТКИЙ ОПИС
virt-sparsify [--options] indisk outdisk
ОПИС
Virt-sparsify is a tool which can make a virtual machine disk (or any disk image) sparse a.k.a. thin-provisioned. This means that free space within the disk image can be converted back to free space on the host. Virt-sparsify can locate and sparsify free space in most filesystems (eg. ext2/3/4, btrfs, NTFS, etc.), and also in LVM physical volumes. Virt-sparsify can also convert between some disk formats, for example converting a raw disk image to a thin-provisioned qcow2 image. Virt-sparsify can operate on any disk image, not just ones from virtual machines. However if a virtual machine has multiple disks and uses volume management, then virt-sparsify will work but not be very effective (http://bugzilla.redhat.com/887826). IMPORTANT NOTE ABOUT SPARSE OUTPUT IMAGES If the input is raw, then the default output is raw sparse. You must check the output size using a tool that understands sparseness such as "du -sh". It can make a huge difference: $ ls -lh test1.img -rw-rw-r--. 1 rjones rjones 100M Aug 8 08:08 test1.img $ du -sh test1.img 3.6M test1.img (Compare the apparent size 100M vs the actual size 3.6M) ВАЖЛИВІ ОБМЕЖЕННЯ • Virt-sparsify does not do in-place modifications. It copies from a source image to a destination image, leaving the source unchanged. Check that the sparsification was successful before deleting the source image. • The virtual machine must be shut down before using this tool. • Virt-sparsify may require up to 2x the virtual size of the source disk image (1 temporary copy + 1 destination image). This is in the worst case and usually much less space is required. • Virt-sparsify cannot resize disk images. To do that, use virt-resize(1). • Virt-sparsify cannot handle encrypted disks. Libguestfs supports encrypted disks, but encrypted disks themselves cannot be sparsified. • Virt-sparsify cannot yet sparsify the space between partitions. Note that this space is often used for critical items like bootloaders so it's not really unused. You may also want to read the manual pages for the associated tools virt-filesystems(1) and virt-df(1) before starting.
ПРИКЛАДИ
Типовий приклад використання: virt-sparsify indisk outdisk which copies "indisk" to "outdisk", making the output sparse. "outdisk" is created, or overwritten if it already exists. The format of the input disk is detected (eg. qcow2) and the same format is used for the output disk. To convert between formats, use the --convert option: virt-sparsify disk.raw --convert qcow2 disk.qcow2 Virt-sparsify tries to zero and sparsify free space on every filesystem it can find within the source disk image. You can get it to ignore (don't zero free space on) certain filesystems by doing: virt-sparsify --ignore /dev/sda1 indisk outdisk See virt-filesystems(1) to get a list of filesystems within a disk image.
ПАРАМЕТРИ
--help Показати довідкове повідомлення. --check-tmpdir=ignore --check-tmpdir=continue --check-tmpdir=warn --check-tmpdir=fail Check if "TMPDIR" has enough space to complete the operation. This is just an estimate. If the check indicates a problem, then you can either: • ignore it, • print a warning and continue, • warn and wait for the user to press the Return key (this is the default), or: • fail and exit. --compress Compress the output file. This only works if the output format is "qcow2". --convert raw --convert qcow2 --convert [інші формати] Use "output-format" as the format for the destination image. If this is not specified, then the input format is used. Supported and known-working output formats are: "raw", "qcow2", "vdi". You can also use any format supported by the qemu-img(1) program, eg. "vmdk", but support for other formats is reliant on qemu. Specifying the --convert option is usually a good idea, because then virt-sparsify doesn't need to try to guess the input format. For fine-tuning the output format, see: --compress, -o. --debug-gc Debug garbage collection and memory allocation. This is only useful when debugging memory problems in virt-sparsify or the OCaml libguestfs bindings. --format raw --format qcow2 Specify the format of the input disk image. If this flag is not given then it is auto-detected from the image itself. If working with untrusted raw-format guest disk images, you should ensure the format is always specified. --ignore файлова_система --ignore група_томів Ignore the named filesystem. Free space on the filesystem will not be zeroed, but existing blocks of zeroes will still be sparsified. In the second form, this ignores the named volume group. Use the volume group name without the "/dev/" prefix, eg. --ignore vg_foo Цей параметр можна вказувати декілька разів. --machine-readable This option is used to make the output more machine friendly when being parsed by other programs. See "MACHINE READABLE OUTPUT" below. -o параметр[,параметр,...] Pass -o option(s) to the qemu-img(1) command to fine-tune the output format. Options available depend on the output format (see --convert) and the installed version of the qemu-img program. You should use -o at most once. To pass multiple options, separate them with commas, eg: virt-sparsify --convert qcow2 \ -o cluster_size=512,preallocation=metadata ... -q --quiet This disables progress bars and other unnecessary output. -v --verbose Увімкнути докладний показ повідомлень з метою діагностики. -V --version Показати дані щодо версії і завершити роботу. -x Увімкнути трасування викликів програмного інтерфейсу libguestfs. --zero розділ --zero логічний_том Zero the contents of the named partition or logical volume in the guest. All data on the device is lost, but sparsification is excellent! You can give this option multiple times.
MACHINE READABLE OUTPUT
The --machine-readable option can be used to make the output more machine friendly, which is useful when calling virt-sparsify from other programs, GUIs etc. Існує два способи використання цього параметра. Firstly use the option on its own to query the capabilities of the virt-sparsify binary. Typical output looks like this: $ virt-sparsify --machine-readable virt-sparsify ntfs btrfs A list of features is printed, one per line, and the program exits with status 0. Secondly use the option in conjunction with other options to make the regular program output more machine friendly. У поточній версії це означає таке: 1. Progress bar messages can be parsed from stdout by looking for this regular expression: ^[0-9]+/[0-9]+$ 2. The calling program should treat messages sent to stdout (except for progress bar messages) as status messages. They can be logged and/or displayed to the user. 3. The calling program should treat messages sent to stderr as error messages. In addition, virt-sparsify exits with a non-zero status code if there was a fatal error. All versions of virt-sparsify have supported the --machine-readable option.
WINDOWS 8
Windows 8 "fast startup" can prevent virt-sparsify from working. See "WINDOWS HIBERNATION AND WINDOWS 8 FAST STARTUP" in guestfs(3).
СТАН ВИХОДУ
Ця програма повертає значення 0 у разі успішного завершення і ненульове значення, якщо сталася помилка.
ЗМІННІ СЕРЕДОВИЩА
TMPDIR Location of the temporary directory used for the potentially large temporary overlay file. You should ensure there is enough free space in the worst case for a full copy of the source disk (virtual size), or else set $TMPDIR to point to another directory that has enough space. Типовим значенням є "/tmp". Note that if $TMPDIR is a tmpfs (eg. if "/tmp" is on tmpfs, or if you use "TMPDIR=/dev/shm"), tmpfs defaults to a maximum size of half of physical RAM. If virt-sparsify exceeds this, it will hang. The solution is either to use a real disk, or to increase the maximum size of the tmpfs mountpoint, eg: mount -o remount,size=10G /tmp Опис інших змінних середовища наведено у розділі "ENVIRONMENT VARIABLES" in guestfs(3).
ТАКОЖ ПЕРЕГЛЯНЬТЕ
virt-filesystems(1), virt-df(1), virt-resize(1), virt-rescue(1), guestfs(3), guestfish(1), truncate(1), fallocate(1), qemu-img(1), http://libguestfs.org/.
АВТОР
Richard W.M. Jones http://people.redhat.com/~rjones/
АВТОРСЬКІ ПРАВА
© Red Hat Inc., 2011–2012
LICENSE
BUGS
To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools When reporting a bug, please supply: • The version of libguestfs. • Where you got libguestfs (eg. which Linux distro, compiled from source, etc) • Describe the bug accurately and give a way to reproduce it. • Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.