.\" Automatically generated by Podwrapper::Man 1.28.1 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "virt-sysprep 1" .TH virt-sysprep 1 "2014-10-18" "libguestfs-1.28.1" "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "НАЗВА" .IX Header "НАЗВА" virt-sysprep \- Reset, unconfigure or customize a virtual machine so clones can be made .SH "КОРОТКИЙ ОПИС" .IX Header "КОРОТКИЙ ОПИС" .Vb 1 \& virt\-sysprep [\-\-параметри] \-d назва_домену \& \& virt\-sysprep [\-\-параметри] \-a disk.img [\-a disk.img ...] .Ve .SH "ОПИС" .IX Header "ОПИС" Virt-sysprep can reset or unconfigure a virtual machine so that clones can be made from it. Steps in this process include removing \s-1SSH\s0 host keys, removing persistent network \s-1MAC\s0 configuration, and removing user accounts. Virt-sysprep can also customize a virtual machine, for instance by adding \&\s-1SSH\s0 keys, users or logos. Each step can be enabled or disabled as required. .PP Virt-sysprep modifies the guest or disk image \fIin place\fR. The guest must be shut down. If you want to preserve the existing contents of the guest, \&\fIyou must snapshot, copy or clone the disk first\fR. See \*(L"\s-1COPYING AND CLONING\*(R"\s0 below. .PP You do \fInot\fR need to run virt-sysprep as root. In fact we'd generally recommend that you don't. The time you might want to run it as root is when you need root in order to access the disk image, but even in this case it would be better to change the permissions on the disk image to be writable as the non-root user running virt-sysprep. .PP \&\*(L"Sysprep\*(R" stands for \*(L"system preparation\*(R" tool. The name comes from the Microsoft program \f(CW\*(C`sysprep.exe\*(C'\fR which is used to unconfigure Windows machines in preparation for cloning them. Having said that, virt-sysprep does \fInot\fR currently work on Microsoft Windows guests. We plan to support Windows sysprepping in a future version, and we already have code to do it. .SH "ПАРАМЕТРИ" .IX Header "ПАРАМЕТРИ" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Показати коротку довідку. .IP "\fB\-a\fR файл" 4 .IX Item "-a файл" .PD 0 .IP "\fB\-\-add\fR файл" 4 .IX Item "--add файл" .PD Додати \fIфайл\fR, який має бути образом диска з віртуальної машини. .Sp Формат образу диска визначається автоматично. Щоб перевизначити його і примусово використати певний формат, скористайтеся параметром \fI\-\-format\fR. .IP "\fB\-a\fR адреса" 4 .IX Item "-a адреса" .PD 0 .IP "\fB\-\-add\fR адреса" 4 .IX Item "--add адреса" .PD Add a remote disk. The \s-1URI\s0 format is compatible with guestfish. See \&\*(L"\s-1ADDING REMOTE STORAGE\*(R"\s0 in \fIguestfish\fR\|(1). .IP "\fB\-c\fR адреса" 4 .IX Item "-c адреса" .PD 0 .IP "\fB\-\-connect\fR адреса" 4 .IX Item "--connect адреса" .PD Якщо використовується libvirt, встановити з’єднання з вказаним \fI\s-1URI\s0\fR. Якщо пропущено, з’єднання буде встановлено з типовим гіпервізором libvirt. .Sp Якщо вказати блокові пристрої гостьових систем безпосередньо (\fI\-a\fR), libvirt не буде використовуватися взагалі. .IP "\fB\-d\fR гість" 4 .IX Item "-d гість" .PD 0 .IP "\fB\-\-domain\fR гість" 4 .IX Item "--domain гість" .PD Додати всі диски з вказаної гостьової системи libvirt. \s-1UUID\s0 доменів можна використовувати замість назв. .IP "\fB\-n\fR" 4 .IX Item "-n" .PD 0 .IP "\fB\-\-dry\-run\fR" 4 .IX Item "--dry-run" .PD Perform a read-only \*(L"dry run\*(R" on the guest. This runs the sysprep operation, but throws away any changes to the disk at the end. .IP "\fB\-\-enable\fR дії" 4 .IX Item "--enable дії" Choose which sysprep operations to perform. Give a comma-separated list of operations, for example: .Sp .Vb 1 \& \-\-enable ssh\-hostkeys,udev\-persistent\-net .Ve .Sp would enable \s-1ONLY \s0\f(CW\*(C`ssh\-hostkeys\*(C'\fR and \f(CW\*(C`udev\-persistent\-net\*(C'\fR operations. .Sp If the \fI\-\-enable\fR option is not given, then we default to trying most sysprep operations (see \fI\-\-list\-operations\fR to show which are enabled). .Sp Regardless of the \fI\-\-enable\fR option, sysprep operations are skipped for some guest types. .Sp Use \fI\-\-list\-operations\fR to list operations supported by a particular version of virt-sysprep. .Sp See \*(L"\s-1OPERATIONS\*(R"\s0 below for a list and an explanation of each operation. .IP "\fB\-\-operation\fR дії" 4 .IX Item "--operation дії" .PD 0 .IP "\fB\-\-operations\fR дії" 4 .IX Item "--operations дії" .PD Choose which sysprep operations to perform. Give a comma-separated list of operations, for example: .Sp .Vb 1 \& \-\-operations ssh\-hostkeys,udev\-persistent\-net .Ve .Sp would enable \s-1ONLY \s0\f(CW\*(C`ssh\-hostkeys\*(C'\fR and \f(CW\*(C`udev\-persistent\-net\*(C'\fR operations. .Sp \&\fI\-\-operations\fR allows you to enable and disable any operation, including the default ones (which would be tried when specifying neither \&\fI\-\-operations\fR nor \fI\-\-enable\fR) and all the available ones; prepending a \&\f(CW\*(C`\-\*(C'\fR in front of an operation name removes it from the list of enabled operations, while the meta-names \f(CW\*(C`defaults\*(C'\fR and \f(CW\*(C`all\*(C'\fR represent respectively the operations enabled by default and all the available ones. For example: .Sp .Vb 1 \& \-\-operations firewall\-rules,defaults,\-tmp\-files .Ve .Sp would enable the \f(CW\*(C`firewall\-rules\*(C'\fR operation (regardless whether it is enabled by default), all the default ones, and disable the \f(CW\*(C`tmp\-files\*(C'\fR operation. .Sp \&\fI\-\-operations\fR can be specified multiple times; the first time the set of enabled operations is empty, while any further \fI\-\-operations\fR affects the operations enabled so far. .Sp If the \fI\-\-operations\fR option is not given, then we default to trying most sysprep operations (see \fI\-\-list\-operations\fR to show which are enabled). .Sp Regardless of the \fI\-\-operations\fR option, sysprep operations are skipped for some guest types. .Sp Use \fI\-\-list\-operations\fR to list operations supported by a particular version of virt-sysprep. .Sp See \*(L"\s-1OPERATIONS\*(R"\s0 below for a list and an explanation of each operation. .IP "\fB\-\-format\fR raw|qcow2|.." 4 .IX Item "--format raw|qcow2|.." .PD 0 .IP "\fB\-\-format\fR auto" 4 .IX Item "--format auto" .PD Типовим значенням для параметра \fI\-a\fR є автоматичне визначення формату образу диска. Використання цього параметра примусово визначає значення параметрів \fI\-a\fR формату диска у наступному рядку команди. Використання параметра \fI\-\-format auto\fR перемикає програму у режим автоматичного визначення у наступних параметрах \fI\-a\fR. .Sp Приклад: .Sp .Vb 1 \& virt\-sysprep \-\-format raw \-a disk.img .Ve .Sp примусове встановлення формату без обробки (без автоматичного визначення) для \f(CW\*(C`disk.img\*(C'\fR. .Sp .Vb 1 \& virt\-sysprep \-\-format raw \-a disk.img \-\-format auto \-a another.img .Ve .Sp примусове встановлення формату без обробки (без автоматичного визначення) для \f(CW\*(C`disk.img\*(C'\fR і повернення до автоматичного визначення для \f(CW\*(C`another.img\*(C'\fR. .Sp Якщо ви користуєтеся ненадійними образами гостьових систем у необробленому форматі, вам слід скористатися цим параметром для визначення формату диска. Таким чином можна уникнути можливих проблем з захистом для сформованих зловмисниками гостьових систем (\s-1CVE\-2010\-3851\s0). .IP "\fB\-\-list\-operations\fR" 4 .IX Item "--list-operations" List the operations supported by the virt-sysprep program. .Sp These are listed one per line, with one or more single-space-separated fields, eg: .Sp .Vb 6 \& $ virt\-sysprep \-\-list\-operations \& bash\-history * Remove the bash history in the guest \& cron\-spool * Remove user at\-jobs and cron\-jobs \& dhcp\-client\-state * Remove DHCP client leases \& dhcp\-server\-state * Remove DHCP server leases \& [etc] .Ve .Sp The first field is the operation name, which can be supplied to \&\fI\-\-enable\fR. The second field is a \f(CW\*(C`*\*(C'\fR character if the operation is enabled by default or blank if not. Subsequent fields on the same line are the description of the operation. .Sp Before libguestfs 1.17.33 only the first (operation name) field was shown and all operations were enabled by default. .IP "\fB\-\-mount\-options\fR mp:opts[;mp:opts;...]" 4 .IX Item "--mount-options mp:opts[;mp:opts;...]" Set the mount options used when libguestfs opens the disk image. Note this has no effect on the guest. It is used when opening certain guests such as ones using the \s-1UFS \s0(\s-1BSD\s0) filesystem. .Sp Use a semicolon-separated list of \f(CW\*(C`mountpoint:options\*(C'\fR pairs. You may need to quote this list to protect it from the shell. .Sp Приклад: .Sp .Vb 1 \& \-\-mount\-options "/:noatime" .Ve .Sp will mount the root directory with \f(CW\*(C`notime\*(C'\fR. This example: .Sp .Vb 1 \& \-\-mount\-options "/:noatime;/var:rw,nodiratime" .Ve .Sp will do the same, plus mount \f(CW\*(C`/var\*(C'\fR with \f(CW\*(C`rw,nodiratime\*(C'\fR. .IP "\fB\-q\fR" 4 .IX Item "-q" .PD 0 .IP "\fB\-\-quiet\fR" 4 .IX Item "--quiet" .PD Не виводити повідомлень до журналу. .Sp To enable detailed logging of individual file operations, use \fI\-x\fR. .IP "\fB\-v\fR" 4 .IX Item "-v" .PD 0 .IP "\fB\-\-verbose\fR" 4 .IX Item "--verbose" .PD Увімкнути докладний показ повідомлень з метою діагностики. .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 .IP "\fB\-\-version\fR" 4 .IX Item "--version" .PD Показати дані щодо версії і завершити роботу. .IP "\fB\-x\fR" 4 .IX Item "-x" Увімкнути трасування викликів програмного інтерфейсу libguestfs. .ie n .IP "\fB\-\-chmod\fR \s-1PERMISSIONS:FILE \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-chmod\fR \s-1PERMISSIONS:FILE \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--chmod PERMISSIONS:FILE (see customize below)" Change the permissions of \f(CW\*(C`FILE\*(C'\fR to \f(CW\*(C`PERMISSIONS\*(C'\fR. .Sp \&\fINote\fR: \f(CW\*(C`PERMISSIONS\*(C'\fR by default would be decimal, unless you prefix it with \f(CW0\fR to get octal, ie. use \f(CW0700\fR not \f(CW700\fR. .ie n .IP "\fB\-\-delete\fR \s-1PATH \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-delete\fR \s-1PATH \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--delete PATH (see customize below)" Delete a file from the guest. Or delete a directory (and all its contents, recursively). .Sp Див. також \fI\-\-upload\fR, \fI\-\-scrub\fR. .ie n .IP "\fB\-\-edit\fR \s-1FILE:EXPR \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-edit\fR \s-1FILE:EXPR \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--edit FILE:EXPR (see customize below)" Edit \f(CW\*(C`FILE\*(C'\fR using the Perl expression \f(CW\*(C`EXPR\*(C'\fR. .Sp Be careful to properly quote the expression to prevent it from being altered by the shell. .Sp Note that this option is only available when Perl 5 is installed. .Sp Див. \*(L"NON-INTERACTIVE \s-1EDITING\*(R"\s0 in \fIvirt\-edit\fR\|(1). .ie n .IP "\fB\-\-firstboot\fR \s-1SCRIPT \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-firstboot\fR \s-1SCRIPT \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--firstboot SCRIPT (see customize below)" Install \f(CW\*(C`SCRIPT\*(C'\fR inside the guest, so that when the guest first boots up, the script runs (as root, late in the boot process). .Sp The script is automatically chmod +x after installation in the guest. .Sp The alternative version \fI\-\-firstboot\-command\fR is the same, but it conveniently wraps the command up in a single line script for you. .Sp You can have multiple \fI\-\-firstboot\fR options. They run in the same order that they appear on the command line. .Sp Див. також \fI\-\-run\fR. .ie n .IP "\fB\-\-firstboot\-command\fR '\s-1CMD+ARGS\s0' (see ""customize"" below)" 4 .el .IP "\fB\-\-firstboot\-command\fR '\s-1CMD+ARGS\s0' (see \f(CWcustomize\fR below)" 4 .IX Item "--firstboot-command 'CMD+ARGS' (see customize below)" Run command (and arguments) inside the guest when the guest first boots up (as root, late in the boot process). .Sp You can have multiple \fI\-\-firstboot\fR options. They run in the same order that they appear on the command line. .Sp Див. також \fI\-\-run\fR. .ie n .IP "\fB\-\-firstboot\-install\fR \s-1PKG,PKG.. \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-firstboot\-install\fR \s-1PKG,PKG.. \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--firstboot-install PKG,PKG.. (see customize below)" Install the named packages (a comma-separated list). These are installed when the guest first boots using the guest's package manager (eg. apt, yum, etc.) and the guest's network connection. .Sp For an overview on the different ways to install packages, see \&\*(L"\s-1INSTALLING PACKAGES\*(R"\s0 in \fIvirt\-builder\fR\|(1). .ie n .IP "\fB\-\-hostname\fR \s-1HOSTNAME \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-hostname\fR \s-1HOSTNAME \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--hostname HOSTNAME (see customize below)" Set the hostname of the guest to \f(CW\*(C`HOSTNAME\*(C'\fR. You can use a dotted hostname.domainname (\s-1FQDN\s0) if you want. .ie n .IP "\fB\-\-install\fR \s-1PKG,PKG.. \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-install\fR \s-1PKG,PKG.. \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--install PKG,PKG.. (see customize below)" Install the named packages (a comma-separated list). These are installed during the image build using the guest's package manager (eg. apt, yum, etc.) and the host's network connection. .Sp For an overview on the different ways to install packages, see \&\*(L"\s-1INSTALLING PACKAGES\*(R"\s0 in \fIvirt\-builder\fR\|(1). .Sp Див. також \fI\-\-update\fR. .ie n .IP "\fB\-\-keep\-user\-accounts\fR \s-1USERS \s0(see ""user\-account"" below)" 4 .el .IP "\fB\-\-keep\-user\-accounts\fR \s-1USERS \s0(see \f(CWuser\-account\fR below)" 4 .IX Item "--keep-user-accounts USERS (see user-account below)" Облікові записи користувачів, які слід залишити у гостьовій системі. Значенням цього параметра є список імен користувачів, відокремлених комами, який визначатиме ті записи, які слід зберегти. Приклад: .Sp .Vb 1 \& \-\-keep\-user\-accounts mary .Ve .Sp збереже обліковий запис користувача \f(CW\*(C`mary\*(C'\fR. .Sp Цей параметр можна вказувати декілька разів у одній команді. .ie n .IP "\fB\-\-link\fR TARGET:LINK[:LINK..] (see ""customize"" below)" 4 .el .IP "\fB\-\-link\fR TARGET:LINK[:LINK..] (see \f(CWcustomize\fR below)" 4 .IX Item "--link TARGET:LINK[:LINK..] (see customize below)" Create symbolic link(s) in the guest, starting at \f(CW\*(C`LINK\*(C'\fR and pointing at \&\f(CW\*(C`TARGET\*(C'\fR. .ie n .IP "\fB\-\-mkdir\fR \s-1DIR \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-mkdir\fR \s-1DIR \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--mkdir DIR (see customize below)" Create a directory in the guest. .Sp This uses \f(CW\*(C`mkdir \-p\*(C'\fR so any intermediate directories are created, and it also works if the directory already exists. .ie n .IP "\fB\-\-no\-logfile\fR (see ""customize"" below)" 4 .el .IP "\fB\-\-no\-logfile\fR (see \f(CWcustomize\fR below)" 4 .IX Item "--no-logfile (see customize below)" Scrub \f(CW\*(C`builder.log\*(C'\fR (log file from build commands) from the image after building is complete. If you don't want to reveal precisely how the image was built, use this option. .Sp Див. також \*(L"\s-1LOG FILE\*(R"\s0. .ie n .IP "\fB\-\-password\fR \s-1USER:SELECTOR \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-password\fR \s-1USER:SELECTOR \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--password USER:SELECTOR (see customize below)" Set the password for \f(CW\*(C`USER\*(C'\fR. (Note this option does \fInot\fR create the user account). .Sp See \*(L"\s-1USERS AND PASSWORDS\*(R"\s0 in \fIvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts. .ie n .IP "\fB\-\-password\-crypto\fR md5|sha256|sha512 (see ""customize"" below)" 4 .el .IP "\fB\-\-password\-crypto\fR md5|sha256|sha512 (see \f(CWcustomize\fR below)" 4 .IX Item "--password-crypto md5|sha256|sha512 (see customize below)" When the virt tools change or set a password in the guest, this option sets the password encryption of that password to \f(CW\*(C`md5\*(C'\fR, \f(CW\*(C`sha256\*(C'\fR or \f(CW\*(C`sha512\*(C'\fR. .Sp \&\f(CW\*(C`sha256\*(C'\fR and \f(CW\*(C`sha512\*(C'\fR require glibc ≥ 2.7 (check \fIcrypt\fR\|(3) inside the guest). .Sp \&\f(CW\*(C`md5\*(C'\fR працюватиме з відносно давніми гостьовими системами Linux (наприкладRHEL 3), але є незахищеним щодо новітніх способів атак. .Sp Типовим способом шифрування є \f(CW\*(C`sha512\*(C'\fR. Він використовується, якщо libguestfs вдасться виявити у гостьовій системі підтримку \s-1SHA\-512.\s0 Якщо такої підтримки не буде виявлено, використовуватиметься \f(CW\*(C`md5\*(C'\fR. За допомогою цього параметра ви можете перевизначити автоматично визначений libguestfs спосіб шифрування. .Sp Note this does not change the default password encryption used by the guest when you create new user accounts inside the guest. If you want to do that, then you should use the \fI\-\-edit\fR option to modify \&\f(CW\*(C`/etc/sysconfig/authconfig\*(C'\fR (Fedora, \s-1RHEL\s0) or \f(CW\*(C`/etc/pam.d/common\-password\*(C'\fR (Debian, Ubuntu). .ie n .IP "\fB\-\-remove\-user\-accounts\fR \s-1USERS \s0(see ""user\-account"" below)" 4 .el .IP "\fB\-\-remove\-user\-accounts\fR \s-1USERS \s0(see \f(CWuser\-account\fR below)" 4 .IX Item "--remove-user-accounts USERS (see user-account below)" Облікові записи користувачів, які слід вилучити з гостьової системи. Значенням цього параметра є список імен користувачів, відокремлених комами, який визначатиме ті записи, які слід вилучити. Приклад: .Sp .Vb 1 \& \-\-remove\-user\-accounts bob,eve .Ve .Sp would only remove the user accounts \f(CW\*(C`bob\*(C'\fR and \f(CW\*(C`eve\*(C'\fR. .Sp Цей параметр можна вказувати декілька разів у одній команді. .ie n .IP "\fB\-\-root\-password\fR \s-1SELECTOR \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-root\-password\fR \s-1SELECTOR \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--root-password SELECTOR (see customize below)" Встановити пароль користувача root. .Sp See \*(L"\s-1USERS AND PASSWORDS\*(R"\s0 in \fIvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts. .Sp Note: In virt-builder, if you \fIdon't\fR set \fI\-\-root\-password\fR then the guest is given a \fIrandom\fR root password. .ie n .IP "\fB\-\-run\fR \s-1SCRIPT \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-run\fR \s-1SCRIPT \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--run SCRIPT (see customize below)" Run the shell script (or any program) called \f(CW\*(C`SCRIPT\*(C'\fR on the disk image. The script runs virtualized inside a small appliance, chrooted into the guest filesystem. .Sp The script is automatically chmod +x. .Sp If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections. You can also attach data disks (eg. \s-1ISO\s0 files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR). You can also upload data files (\fI\-\-upload\fR). .Sp You can have multiple \fI\-\-run\fR options. They run in the same order that they appear on the command line. .Sp See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR. .ie n .IP "\fB\-\-run\-command\fR '\s-1CMD+ARGS\s0' (see ""customize"" below)" 4 .el .IP "\fB\-\-run\-command\fR '\s-1CMD+ARGS\s0' (see \f(CWcustomize\fR below)" 4 .IX Item "--run-command 'CMD+ARGS' (see customize below)" Run the command and arguments on the disk image. The command runs virtualized inside a small appliance, chrooted into the guest filesystem. .Sp If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections. You can also attach data disks (eg. \s-1ISO\s0 files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR). You can also upload data files (\fI\-\-upload\fR). .Sp You can have multiple \fI\-\-run\-command\fR options. They run in the same order that they appear on the command line. .Sp See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR. .ie n .IP "\fB\-\-script\fR \s-1SCRIPT \s0(see ""script"" below)" 4 .el .IP "\fB\-\-script\fR \s-1SCRIPT \s0(see \f(CWscript\fR below)" 4 .IX Item "--script SCRIPT (see script below)" Run the named \f(CW\*(C`SCRIPT\*(C'\fR (a shell script or program) against the guest. The script can be any program on the host. The script's current directory will be the guest's root directory. .Sp \&\fBNote:\fR If the script is not on the \f(CW$PATH\fR, then you must give the full absolute path to the script. .ie n .IP "\fB\-\-scriptdir\fR \s-1SCRIPTDIR \s0(see ""script"" below)" 4 .el .IP "\fB\-\-scriptdir\fR \s-1SCRIPTDIR \s0(see \f(CWscript\fR below)" 4 .IX Item "--scriptdir SCRIPTDIR (see script below)" Точку монтування (порожній каталог на вузлі), використану при виконанні дії \&\f(CW\*(C`script\*(C'\fR, увімкнено і вказано використання одного або декількох скриптів за допомогою \fI\-\-script\fR. .Sp \&\fBЗауваження:\fR \f(CW\*(C`SCRIPTDIR\*(C'\fR \fBмає\fR бути вказано повністю. .Sp Якщо \fI\-\-scriptdir\fR не вказано, буде створено тимчасову точку монтування .ie n .IP "\fB\-\-scrub\fR \s-1FILE \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-scrub\fR \s-1FILE \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--scrub FILE (see customize below)" Витерти файл з гостьової системи. Подібне до \fI\-\-delete\fR, окрім того, що: .RS 4 .IP "\(bu" 4 It scrubs the data so a guest could not recover it. .IP "\(bu" 4 It cannot delete directories, only regular files. .RE .RS 4 .RE .ie n .IP "\fB\-\-selinux\-relabel\fR (see ""customize"" below)" 4 .el .IP "\fB\-\-selinux\-relabel\fR (see \f(CWcustomize\fR below)" 4 .IX Item "--selinux-relabel (see customize below)" Relabel files in the guest so that they have the correct SELinux label. .Sp You should only use this option for guests which support SELinux. .ie n .IP "\fB\-\-timezone\fR \s-1TIMEZONE \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-timezone\fR \s-1TIMEZONE \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--timezone TIMEZONE (see customize below)" Set the default timezone of the guest to \f(CW\*(C`TIMEZONE\*(C'\fR. Use a location string like \f(CW\*(C`Europe/London\*(C'\fR .ie n .IP "\fB\-\-update\fR (see ""customize"" below)" 4 .el .IP "\fB\-\-update\fR (see \f(CWcustomize\fR below)" 4 .IX Item "--update (see customize below)" Do the equivalent of \f(CW\*(C`yum update\*(C'\fR, \f(CW\*(C`apt\-get upgrade\*(C'\fR, or whatever command is required to update the packages already installed in the template to their latest versions. .Sp Див. також \fI\-\-install\fR. .ie n .IP "\fB\-\-upload\fR \s-1FILE:DEST \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-upload\fR \s-1FILE:DEST \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--upload FILE:DEST (see customize below)" Upload local file \f(CW\*(C`FILE\*(C'\fR to destination \f(CW\*(C`DEST\*(C'\fR in the disk image. File owner and permissions from the original are preserved, so you should set them to what you want them to be in the disk image. .Sp \&\f(CW\*(C`DEST\*(C'\fR could be the final filename. This can be used to rename the file on upload. .Sp If \f(CW\*(C`DEST\*(C'\fR is a directory name (which must already exist in the guest) then the file is uploaded into that directory, and it keeps the same name as on the local filesystem. .Sp Див. також \fI\-\-mkdir\fR, \fI\-\-delete\fR, \fI\-\-scrub\fR. .ie n .IP "\fB\-\-write\fR \s-1FILE:CONTENT \s0(see ""customize"" below)" 4 .el .IP "\fB\-\-write\fR \s-1FILE:CONTENT \s0(see \f(CWcustomize\fR below)" 4 .IX Item "--write FILE:CONTENT (see customize below)" Записати \f(CW\*(C`ДАНІ\*(C'\fR до файла \f(CW\*(C`ФАЙЛ\*(C'\fR. .SH "ДІЇ" .IX Header "ДІЇ" If the \fI\-\-enable\fR/\fI\-\-operations\fR option is \fInot\fR given, then most sysprep operations are enabled. .PP Use \f(CW\*(C`virt\-sysprep \-\-list\-operations\*(C'\fR to list all operations for your virt-sysprep binary. The ones which are enabled by default are marked with a \f(CW\*(C`*\*(C'\fR character. Regardless of the \fI\-\-enable\fR/\fI\-\-operations\fR options, sysprep operations are skipped for some guest types. .PP Operations can be individually enabled using the \fI\-\-enable\fR/\fI\-\-operations\fR options. Use a comma-separated list, for example: .PP .Vb 1 \& virt\-sysprep \-\-operations ssh\-hostkeys,udev\-persistent\-net [etc..] .Ve .PP Future versions of virt-sysprep may add more operations. If you are using virt-sysprep and want predictable behaviour, specify only the operations that you want to have enabled. .PP \&\f(CW\*(C`*\*(C'\fR = enabled by default when no \fI\-\-enable\fR/\fI\-\-operations\fR option is given. .SS "\fBabrt-data\fP *" .IX Subsection "abrt-data *" Вилучити дані щодо аварії, створені \s-1ABRT.\s0 .PP Вилучити автоматично створені \s-1ABRT\s0 дані щодо аварії у \f(CW\*(C`/var/spool/abrt/\*(C'\fR. .SS "\fBbash-history\fP *" .IX Subsection "bash-history *" Вилучити журнал команд bash у гостьовій системі. .PP Вилучити журнал команд bash користувача «root» та всіх інших користувачів, у домашніх каталогах яких містяться файли \f(CW\*(C`.bash_history\*(C'\fR. .PP \fINotes on bash-history\fR .IX Subsection "Notes on bash-history" .PP У поточній версії пошук домашніх каталогів користувачів виконується лише у \&\f(CW\*(C`/root\*(C'\fR і \f(CW\*(C`/home/*\*(C'\fR. Отже, журнал bash користувачів, дані яких зберігаються у інших каталогах, не буде вилучено. .SS "\fBblkid-tab\fP *" .IX Subsection "blkid-tab *" Вилучити вкладку ідентифікаторів блоків у гостьовій системі. .SS "\fBca-certificates\fP" .IX Subsection "ca-certificates" Вилучити сертифікати \s-1CA\s0 у гостьовій системі. .SS "\fBcrash-data\fP *" .IX Subsection "crash-data *" Вилучити дані щодо аварії, створені kexec-tools. .PP Вилучити автоматично створені kdump дані аварії ядра. .SS "\fBcron-spool\fP *" .IX Subsection "cron-spool *" Вилучити завдання at та cron користувачів. .SS "\fBcustomize\fP *" .IX Subsection "customize *" Налаштувати гостьову систему. .PP Налаштувати гостьову систему визначенням параметрів \fIvirt\-customize\fR\|(1) для встановлення пакунків, редагування файлів тощо. .SS "\fBdhcp-client-state\fP *" .IX Subsection "dhcp-client-state *" Вилучити надані клієнтські адреси \s-1DHCP.\s0 .SS "\fBdhcp-server-state\fP *" .IX Subsection "dhcp-server-state *" Вилучити надані серверні адреси \s-1DHCP.\s0 .SS "\fBdovecot-data\fP *" .IX Subsection "dovecot-data *" Вилучити дані Dovecot (поштового сервера). .SS "\fBfirewall-rules\fP" .IX Subsection "firewall-rules" Вилучити правила брандмауера. .PP Вилучає нетипові правила брандмауера вилученням \f(CW\*(C`/etc/sysconfig/iptables\*(C'\fR або нетипових налаштувань firewalld з \f(CW\*(C`/etc/firewalld/*/*\*(C'\fR. .PP Зауважте, що цю можливість типово \fIне\fR увімкнено, оскільки може відкрити гостьову систему для вразливостей. Користуйтеся обережно. .SS "\fBflag-reconfiguration\fP" .IX Subsection "flag-reconfiguration" Позначити систему для зміни налаштувань. .PP Для гостьових систем Linux оновлює часову позначку \f(CW\*(C`/.unconfigured\*(C'\fR, отже, під час першого завантаження користувачеві буде надіслано запит щодо параметрів, зокрема пароля root та часового поясу. .SS "\fBfs-uuids\fP" .IX Subsection "fs-uuids" Змінити \s-1UUID\s0 файлових систем. .PP У гостьових системах та типах файлових систем, де передбачено таку підтримку, буде створено нові випадкові \s-1UUID,\s0 які буде пов’язано з файловими системами. .PP \fIЗауваження щодо fs-uuids\fR .IX Subsection "Зауваження щодо fs-uuids" .PP Типово, дію fs-uuids вимкнено, оскільки у поточній версії програма ще не здатна знайти і оновити усі записи у гостьовій системі, які використовують \&\s-1UUID,\s0 наприклад \f(CW\*(C`/etc/fstab\*(C'\fR або завантажувач. Вмикання цієї дії може з високою ймовірністю зробити вашу гостьову систему непридатною до завантаження. .PP Див. https://bugzilla.redhat.com/show_bug.cgi?id=991641 .SS "\fBдані\-kerberos\fP" .IX Subsection "дані-kerberos" Вилучити дані Kerberos у гостьовій системі. .SS "\fBlogfiles\fP *" .IX Subsection "logfiles *" Вилучити з гостьової системи багато файлів журналів. .PP У Linux вилучено такі файли: .PP .Vb 10 \& /etc/Pegasus/*.cnf \& /etc/Pegasus/*.crt \& /etc/Pegasus/*.csr \& /etc/Pegasus/*.pem \& /etc/Pegasus/*.srl \& /root/anaconda\-ks.cfg \& /root/anaconda\-post.log \& /root/initial\-setup\-ks.cfg \& /root/install.log \& /root/install.log.syslog \& /var/cache/fontconfig/* \& /var/cache/gdm/* \& /var/cache/man/* \& /var/lib/AccountService/users/* \& /var/lib/fprint/* \& /var/lib/logrotate.status \& /var/log/*.log* \& /var/log/BackupPC/LOG \& /var/log/ConsoleKit/* \& /var/log/anaconda.syslog \& /var/log/anaconda/* \& /var/log/apache2/*_log \& /var/log/apache2/*_log\-* \& /var/log/apt/* \& /var/log/aptitude* \& /var/log/audit/* \& /var/log/btmp* \& /var/log/ceph/*.log \& /var/log/chrony/*.log \& /var/log/cron* \& /var/log/cups/*_log* \& /var/log/debug* \& /var/log/dmesg* \& /var/log/exim4/* \& /var/log/faillog* \& /var/log/firewalld* \& /var/log/gdm/* \& /var/log/glusterfs/*glusterd.vol.log \& /var/log/glusterfs/glusterfs.log \& /var/log/grubby* \& /var/log/httpd/*log \& /var/log/installer/* \& /var/log/jetty/jetty\-console.log \& /var/log/journal/* \& /var/log/lastlog* \& /var/log/libvirt/libvirtd.log \& /var/log/libvirt/libxl/*.log \& /var/log/libvirt/lxc/*.log \& /var/log/libvirt/qemu/*.log \& /var/log/libvirt/uml/*.log \& /var/log/lightdm/* \& /var/log/mail/* \& /var/log/maillog* \& /var/log/messages* \& /var/log/ntp \& /var/log/ntpstats/* \& /var/log/ppp/connect\-errors \& /var/log/rhsm/* \& /var/log/sa/* \& /var/log/secure* \& /var/log/setroubleshoot/*.log \& /var/log/spooler* \& /var/log/squid/*.log \& /var/log/syslog* \& /var/log/tallylog* \& /var/log/tuned/tuned.log \& /var/log/wtmp* \& /var/log/xferlog* \& /var/named/data/named.run .Ve .SS "\fBlvm-uuids\fP *" .IX Subsection "lvm-uuids *" Змінити \s-1UUID\s0 ФТ і ГТ \s-1LVM2.\s0 .PP Для гостьових систем Linux, які містять фізичні томи (ФТ) або групи томів (ГТ) \s-1LVM2\s0 для ФТ і ГТ буде створено і призначено випадкові \s-1UUID.\s0 .SS "\fBід\-комп’ютера\fP *" .IX Subsection "ід-комп’ютера *" Вилучити ідентифікатор локального комп’ютера. .PP Зазвичай, ідентифікатор системи створюється на основі випадкових джерел даних під час встановлення системи і не змінюється під час всіх наступних її завантажень. За потреби у системах без певного стану цей ідентифікатор створюється під час роботи завантажувача, якщо буде виявлено порожнє значення. .SS "\fBmail-spool\fP *" .IX Subsection "mail-spool *" Вилучити поштове повідомлення з локального каталогу поштового буфера. .SS "\fBnet-hostname\fP *" .IX Subsection "net-hostname *" Вилучити \s-1HOSTNAME\s0 у налаштуваннях інтерфейсу мережі. .PP Для Fedora і Red Hat Enterprise Linux це вилучається з файлів \f(CW\*(C`ifcfg\-*\*(C'\fR. .SS "\fBnet-hwaddr\fP *" .IX Subsection "net-hwaddr *" Вилучити налаштування \s-1HWADDR \s0(апаратної адреси \s-1MAC\s0). .PP Для Fedora і Red Hat Enterprise Linux це вилучається з файлів \f(CW\*(C`ifcfg\-*\*(C'\fR. .SS "\fBpacct-log\fP *" .IX Subsection "pacct-log *" Вилучити файли журналу обліку процесів. .PP Дані обліку процесів системи будуть зберігатися у файлах журналу pacct, якщо увімкнено облік процесів. .SS "\fBpackage-manager-cache\fP *" .IX Subsection "package-manager-cache *" Вилучити кеш керування пакунками. .SS "\fBpam-data\fP *" .IX Subsection "pam-data *" Вилучити дані \s-1PAM\s0 у гостьовій системі. .SS "\fBpuppet-data-log\fP *" .IX Subsection "puppet-data-log *" Вилучити дані та файли журналів puppet. .SS "\fBrh-subscription-manager\fP *" .IX Subsection "rh-subscription-manager *" Вилучити файли керування передплатою \s-1RH.\s0 .SS "\fBrhn-systemid\fP *" .IX Subsection "rhn-systemid *" Вилучити ідентифікатор системи у \s-1RHN.\s0 .SS "\fBrpm-db\fP *" .IX Subsection "rpm-db *" Вилучити специфічні для системи файли баз даних \s-1RPM.\s0 .PP Вилучити специфічні для системи файли баз даних \s-1RPM. RPM\s0 буде повторно створено ці файли, якщо це потрібно. .SS "\fBsamba-db-log\fP *" .IX Subsection "samba-db-log *" Вилучити бази даних та файли журналів Samba. .SS "\fBscript\fP *" .IX Subsection "script *" Запустити довільні скрипти дій над гостьовою системою. .PP The \f(CW\*(C`script\*(C'\fR module lets you run arbitrary shell scripts or programs against the guest. .PP Note this feature requires \s-1FUSE\s0 support. You may have to enable this in your host, for example by adding the current user to the \f(CW\*(C`fuse\*(C'\fR group, or by loading a kernel module. .PP Use one or more \fI\-\-script\fR parameters to specify scripts or programs that will be run against the guest. .PP The script or program is run with its current directory being the guest's root directory, so relative paths should be used. For example: \f(CW\*(C`rm etc/resolv.conf\*(C'\fR in the script would remove a Linux guest's \s-1DNS\s0 configuration file, but \f(CW\*(C`rm /etc/resolv.conf\*(C'\fR would (try to) remove the host's file. .PP Normally a temporary mount point for the guest is used, but you can choose a specific one by using the \fI\-\-scriptdir\fR parameter. .PP \&\fBNote:\fR This is different from \fI\-\-firstboot\fR scripts (which run in the context of the guest when it is booting first time). \fI\-\-script\fR scripts run on the host, not in the guest. .SS "\fBsmolt-uuid\fP *" .IX Subsection "smolt-uuid *" Вилучити \s-1UUID\s0 обладнання Smolt. .SS "\fBssh-hostkeys\fP *" .IX Subsection "ssh-hostkeys *" Вилучити ключі вузла \s-1SSH\s0 у гостьовій системі. .PP Ключі вузла \s-1SSH\s0 повторно створюються (незалежно) під час наступного завантаження гостьової системи. .PP Якщо після клонування гостьова система отримати ту саму IP\-адресу, ssh надасть вам додаткове попередження щодо зміни ключа вузла: .PP .Vb 4 \& @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \& @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ \& @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \& IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! .Ve .SS "\fBssh-userdir\fP *" .IX Subsection "ssh-userdir *" Вилучити каталоги «.ssh» у гостьовій системі. .PP Вилучити каталог \f(CW\*(C`.ssh\*(C'\fR користувача «root» та всіх інших користувачів, домашні каталоги яких містять каталог \f(CW\*(C`.ssh\*(C'\fR. .PP \fIЗауваження щодо ssh-userdir\fR .IX Subsection "Зауваження щодо ssh-userdir" .PP У поточній версії пошук домашніх каталогів користувачів виконується лише у \&\f(CW\*(C`/root\*(C'\fR і \f(CW\*(C`/home/*\*(C'\fR. Отже, файли ssh користувачів, дані яких зберігаються у інших каталогах, не буде вилучено. .SS "\fBsssd-db-log\fP *" .IX Subsection "sssd-db-log *" Вилучити бази даних і файли журналів sssd. .SS "\fBtmp-files\fP *" .IX Subsection "tmp-files *" Вилучити тимчасові файли. .PP Вилучає тимчасові файли з \f(CW\*(C`/tmp\*(C'\fR і \f(CW\*(C`/var/tmp\*(C'\fR. .SS "\fBudev-persistent-net\fP *" .IX Subsection "udev-persistent-net *" Вилучити постійні правила мережі udev. .PP Вилучити постійні правила мережі udev, які відображають вже створену MAC\-адресу гостьової системи на фіксований пристрій ethernet (наприклад eth0). .PP Після клонування гостьової системи MAC\-адреса зазвичай змінюється. Оскільки стару MAC\-адресу вже пов’язано зі старою назвою (наприклад eth0), це означає, що нову MAC\-адресу буде пов’язано з новою назвою (наприклад eth1), а це зазвичай є небажаним. За допомогою вилучення постійних правил мережі udev цьому можна запобігти. .SS "\fBuser-account\fP" .IX Subsection "user-account" Вилучити облікові записи користувачів у гостьовій системі. .PP By default remove all the user accounts and their home directories. The \&\*(L"root\*(R" account is not removed. .PP See the \fI\-\-remove\-user\-accounts\fR parameter for a way to specify how to remove only some users, or to not remove some others. .SS "\fButmp\fP *" .IX Subsection "utmp *" Вилучити файл utmp. .PP У цьому файлі зберігаються записи щодо входу користувачів до машини. У сучасних дистрибутивах Linux ці записи зберігаються на диску у пам’яті, тому не є частиною віртуальної машини на диску, але ці дані зберігаються на диску у старіших версіях дистрибутивів. .SS "\fByum-uuid\fP *" .IX Subsection "yum-uuid *" Вилучити \s-1UUID\s0 yum. .PP Yum створить новий \s-1UUID\s0 під час наступного запуску, коли виявить, що початковий \s-1UUID\s0 було вилучено. .SH "КОПІЮВАННЯ ТА КЛОНУВАННЯ" .IX Header "КОПІЮВАННЯ ТА КЛОНУВАННЯ" Virt-sysprep can be used as part of a process of cloning guests, or to prepare a template from which guests can be cloned. There are many different ways to achieve this using the virt tools, and this section is just an introduction. .PP A virtual machine (when switched off) consists of two parts: .IP "\fIналаштування\fR" 4 .IX Item "налаштування" The configuration or description of the guest. eg. The libvirt \s-1XML \s0(see \&\f(CW\*(C`virsh dumpxml\*(C'\fR), the running configuration of the guest, or another external format like \s-1OVF.\s0 .Sp Some configuration items that might need to be changed: .RS 4 .IP "\(bu" 4 назва .IP "\(bu" 4 \&\s-1UUID\s0 .IP "\(bu" 4 шлях до блокових пристроїв .IP "\(bu" 4 MAC\-адреса мережевої картки .RE .RS 4 .RE .IP "\fIблокові пристрої\fR" 4 .IX Item "блокові пристрої" One or more hard disk images, themselves containing files, directories, applications, kernels, configuration, etc. .Sp Some things inside the block devices that might need to be changed: .RS 4 .IP "\(bu" 4 hostname and other net configuration .IP "\(bu" 4 \&\s-1UUID\s0 .IP "\(bu" 4 \&\s-1SSH\s0 host keys .IP "\(bu" 4 Windows unique security \s-1ID \s0(\s-1SID\s0) .IP "\(bu" 4 Puppet registration .RE .RS 4 .RE .SS "КОПІЮВАННЯ БЛОКОВОГО ПРИСТРОЮ" .IX Subsection "КОПІЮВАННЯ БЛОКОВОГО ПРИСТРОЮ" Starting with an original guest, you probably wish to copy the guest block device and its configuration to make a template. Then once you are happy with the template, you will want to make many clones from it. .PP .Vb 7 \& virt\-sysprep \& | \& v \& original guest \-\-\-\-\-\-\-\-> template \-\-\-\-\-\-\-\-\-\-> \& \e\-\-\-\-\-\-> cloned \& \e\-\-\-\-\-> guests \& \e\-\-\-\-> .Ve .PP You can, of course, just copy the block device on the host using \fIcp\fR\|(1) or \&\fIdd\fR\|(1). .PP .Vb 5 \& dd dd \& original guest \-\-\-\-\-\-\-\-> template \-\-\-\-\-\-\-\-\-\-> \& \e\-\-\-\-\-\-> cloned \& \e\-\-\-\-\-> guests \& \e\-\-\-\-> .Ve .PP There are some smarter (and faster) ways too: .PP .Vb 5 \& snapshot \& template \-\-\-\-\-\-\-\-\-\-> \& \e\-\-\-\-\-\-> cloned \& \e\-\-\-\-\-> guests \& \e\-\-\-\-> .Ve .PP You may want to run virt-sysprep twice, once to reset the guest (to make a template) and a second time to customize the guest for a specific user: .PP .Vb 6 \& virt\-sysprep virt\-sysprep \& (reset) (add user, keys, logos) \& | | \& dd v dd v \& original guest \-\-\-\-> template \-\-\-\-\-\-\-\-\-> copied \-\-\-\-\-\-> custom \& template guest .Ve .IP "\(bu" 4 Create a snapshot using qemu-img: .Sp .Vb 1 \& qemu\-img create \-f qcow2 \-o backing_file=original snapshot.qcow .Ve .Sp The advantage is that you don't need to copy the original (very fast) and only changes are stored (less storage required). .Sp Note that writing to the backing file once you have created guests on top of it is not possible: you will corrupt the guests. .IP "\(bu" 4 Create a snapshot using \f(CW\*(C`lvcreate \-\-snapshot\*(C'\fR. .IP "\(bu" 4 Other ways to create snapshots include using filesystems-level tools (for filesystems such as btrfs). .Sp Most Network Attached Storage (\s-1NAS\s0) devices can also create cheap snapshots from files or LUNs. .IP "\(bu" 4 Get your \s-1NAS\s0 to duplicate the \s-1LUN. \s0 Most \s-1NAS\s0 devices can also duplicate LUNs very cheaply (they copy them on-demand in the background). .IP "\(bu" 4 Prepare your template using \fIvirt\-sparsify\fR\|(1). See below. .SS "VIRT-CLONE" .IX Subsection "VIRT-CLONE" A separate tool, \fIvirt\-clone\fR\|(1), can be used to duplicate the block device and/or modify the external libvirt configuration of a guest. It will reset the name, \s-1UUID\s0 and \s-1MAC\s0 address of the guest in the libvirt \s-1XML.\s0 .PP \&\fIvirt\-clone\fR\|(1) does not use libguestfs and cannot look inside the disk image. This was the original motivation to write virt-sysprep. .SS "\s-1SPARSIFY\s0" .IX Subsection "SPARSIFY" .Vb 2 \& virt\-sparsify \& original guest \-\-\-\-\-\-\-\-> template .Ve .PP \&\fIvirt\-sparsify\fR\|(1) can be used to make the cloning template smaller, making it easier to compress and/or faster to copy. .PP Notice that since virt-sparsify also copies the image, you can use it to make the initial copy (instead of \f(CW\*(C`dd\*(C'\fR). .SS "ЗМІНА РОЗМІРІВ" .IX Subsection "ЗМІНА РОЗМІРІВ" .Vb 5 \& virt\-resize \& template \-\-\-\-\-\-\-\-\-\-> \& \e\-\-\-\-\-\-> cloned \& \e\-\-\-\-\-> guests \& \e\-\-\-\-> .Ve .PP If you want to give people cloned guests, but let them pick the size of the guest themselves (eg. depending on how much they are prepared to pay for disk space), then instead of copying the template, you can run \&\fIvirt\-resize\fR\|(1). Virt-resize performs a copy and resize, and thus is ideal for cloning guests from a template. .SH "FIRSTBOOT VS SCRIPT" .IX Header "FIRSTBOOT VS SCRIPT" The two options \fI\-\-firstboot\fR and \fI\-\-script\fR both supply shell scripts that are run against the guest. However these two options are significantly different. .PP \&\fI\-\-firstboot script\fR uploads the file \f(CW\*(C`script\*(C'\fR into the guest and arranges that it will run, in the guest, when the guest is next booted. (The script will only run once, at the \*(L"first boot\*(R"). .PP \&\fI\-\-script script\fR runs the shell \f(CW\*(C`script\*(C'\fR \fIon the host\fR, with its current directory inside the guest filesystem. .PP If you needed, for example, to \f(CW\*(C`yum install\*(C'\fR new packages, then you \fImust not\fR use \fI\-\-script\fR for this, since that would (a) run the \f(CW\*(C`yum\*(C'\fR command on the host and (b) wouldn't have access to the same resources (repositories, keys, etc.) as the guest. Any command that needs to run on the guest \fImust\fR be run via \fI\-\-firstboot\fR. .PP On the other hand if you need to make adjustments to the guest filesystem (eg. copying in files), then \fI\-\-script\fR is ideal since (a) it has access to the host filesystem and (b) you will get immediate feedback on errors. .PP Either or both options can be used multiple times on the command line. .SH "БЕЗПЕКА" .IX Header "БЕЗПЕКА" Although virt-sysprep removes some sensitive information from the guest, it does not pretend to remove all of it. You should examine the \*(L"\s-1OPERATIONS\*(R"\s0 above and the guest afterwards. .PP Sensitive files are simply removed. The data they contained may still exist on the disk, easily recovered with a hex editor or undelete tool. The \&\fI\-\-scrub\fR option can be used to scrub files instead of just deleting them. \&\fIvirt\-sparsify\fR\|(1) is another way to remove this content. See also the \&\fIscrub\fR\|(1) command to get rid of deleted content in directory entries and inodes. .SS "БАЗА ВИПАДКОВОСТІ" .IX Subsection "БАЗА ВИПАДКОВОСТІ" \&\fI(Цей розділ стосується лише гостьових систем Linux)\fR .PP For supported guests, virt-sysprep writes a few bytes of randomness from the host into the guest's random seed file. .PP If this is just done once and the guest is cloned from the same template, then each guest will start with the same entropy, and things like \s-1SSH\s0 host keys and \s-1TCP\s0 sequence numbers may be predictable. .PP Therefore you should arrange to add more randomness \fIafter\fR cloning from a template too, which can be done by enabling just the customize module: .PP .Vb 2 \& cp template.img newguest.img \& virt\-sysprep \-\-enable customize \-a newguest.img .Ve .SH "WINDOWS 8" .IX Header "WINDOWS 8" Windows 8 \*(L"fast startup\*(R" can prevent virt-sysprep from working. See \&\*(L"\s-1WINDOWS HIBERNATION AND WINDOWS 8 FAST STARTUP\*(R"\s0 in \fIguestfs\fR\|(3). .SH "СТАН ВИХОДУ" .IX Header "СТАН ВИХОДУ" This program returns 0 on success, or 1 if there was an error. .SH "ЗМІННІ СЕРЕДОВИЩА" .IX Header "ЗМІННІ СЕРЕДОВИЩА" .ie n .IP """VIRT_TOOLS_DATA_DIR""" 4 .el .IP "\f(CWVIRT_TOOLS_DATA_DIR\fR" 4 .IX Item "VIRT_TOOLS_DATA_DIR" This can point to the directory containing data files used for Windows firstboot installation. .Sp Normally you do not need to set this. If not set, a compiled-in default will be used (something like \f(CW\*(C`/usr/share/virt\-tools\*(C'\fR). .Sp Цей каталог може містити такі файли: .RS 4 .ie n .IP """rhsrvany.exe""" 4 .el .IP "\f(CWrhsrvany.exe\fR" 4 .IX Item "rhsrvany.exe" This is the RHSrvAny Windows binary, used to install a \*(L"firstboot\*(R" script in Windows guests. It is required if you intend to use the \fI\-\-firstboot\fR or \&\fI\-\-firstboot\-command\fR options with Windows guests. .Sp Див. також \f(CW\*(C`https://github.com/rwmjones/rhsrvany\*(C'\fR .RE .RS 4 .RE .PP Опис інших змінних середовища наведено у розділі \*(L"\s-1ENVIRONMENT VARIABLES\*(R"\s0 in \fIguestfs\fR\|(3). .SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ" .IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ" \&\fIguestfs\fR\|(3), \fIguestfish\fR\|(1), \fIvirt\-builder\fR\|(1), \fIvirt\-clone\fR\|(1), \&\fIvirt\-customize\fR\|(1), \fIvirt\-rescue\fR\|(1), \fIvirt\-resize\fR\|(1), \&\fIvirt\-sparsify\fR\|(1), \fIvirsh\fR\|(1), \fIlvcreate\fR\|(8), \fIqemu\-img\fR\|(1), \&\fIscrub\fR\|(1), http://libguestfs.org/, http://libvirt.org/. .SH "АВТОРИ" .IX Header "АВТОРИ" Richard W.M. Jones http://people.redhat.com/~rjones/ .PP Wanlong Gao, Fujitsu Ltd. .SH "АВТОРСЬКІ ПРАВА" .IX Header "АВТОРСЬКІ ПРАВА" Copyright (C) 2011\-2014 Red Hat Inc. .PP Авторські права належать Fujitsu Ltd., 2012 .SH "LICENSE" .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA 02110\-1301 USA.\s0 .SH "BUGS" .IX Header "BUGS" To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools .PP To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP When reporting a bug, please supply: .IP "\(bu" 4 The version of libguestfs. .IP "\(bu" 4 Where you got libguestfs (eg. which Linux distro, compiled from source, etc) .IP "\(bu" 4 Describe the bug accurately and give a way to reproduce it. .IP "\(bu" 4 Run \fIlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR output into the bug report.