224 lines
6.2 KiB
Diff
224 lines
6.2 KiB
Diff
From 9c9877bf262d69b1ab6b265bb17dc3f009dcfffa Mon Sep 17 00:00:00 2001
|
||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||
Date: Tue, 5 May 2026 12:02:11 +0100
|
||
Subject: [PATCH] sysprep: Remove documentation about copying and cloning
|
||
|
||
This documentation is mostly obsolete and doesn't really cover any
|
||
useful use cases these days. It's best to remove it rather than
|
||
trying to keep it up to date.
|
||
|
||
(cherry picked from commit 82edee0cdcb8b0b8cb93d3067b311e8a13bd7a66)
|
||
---
|
||
sysprep/virt-sysprep.pod | 191 +--------------------------------------
|
||
1 file changed, 1 insertion(+), 190 deletions(-)
|
||
|
||
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
|
||
index f044998cc..6b913ad70 100644
|
||
--- a/sysprep/virt-sysprep.pod
|
||
+++ b/sysprep/virt-sysprep.pod
|
||
@@ -19,8 +19,7 @@ can be enabled or disabled as required.
|
||
|
||
Virt-sysprep modifies the guest or disk image I<in place>. The guest
|
||
must be shut down. If you want to preserve the existing contents of
|
||
-the guest, I<you must snapshot, copy or clone the disk first>. See
|
||
-L</COPYING AND CLONING> below.
|
||
+the guest, I<you must snapshot, copy or clone the disk first>.
|
||
|
||
You do I<not> 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
|
||
@@ -301,194 +300,6 @@ is given.
|
||
|
||
__OPERATIONS__
|
||
|
||
-=head1 COPYING AND CLONING
|
||
-
|
||
-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.
|
||
-
|
||
-A virtual machine (when switched off) consists of two parts:
|
||
-
|
||
-=over 4
|
||
-
|
||
-=item I<configuration>
|
||
-
|
||
-The configuration or description of the guest. eg. The libvirt
|
||
-XML (see C<virsh dumpxml>), the running configuration of the guest,
|
||
-or another external format like OVF.
|
||
-
|
||
-Some configuration items that might need to be changed:
|
||
-
|
||
-=over 4
|
||
-
|
||
-=item *
|
||
-
|
||
-name
|
||
-
|
||
-=item *
|
||
-
|
||
-UUID
|
||
-
|
||
-=item *
|
||
-
|
||
-path to block device(s)
|
||
-
|
||
-=item *
|
||
-
|
||
-network card MAC address
|
||
-
|
||
-=back
|
||
-
|
||
-=item I<block device(s)>
|
||
-
|
||
-One or more hard disk images, themselves containing files,
|
||
-directories, applications, kernels, configuration, etc.
|
||
-
|
||
-Some things inside the block devices that might need to be changed:
|
||
-
|
||
-=over 4
|
||
-
|
||
-=item *
|
||
-
|
||
-hostname and other net configuration
|
||
-
|
||
-=item *
|
||
-
|
||
-UUID
|
||
-
|
||
-=item *
|
||
-
|
||
-SSH host keys
|
||
-
|
||
-=item *
|
||
-
|
||
-Windows unique security ID (SID)
|
||
-
|
||
-=item *
|
||
-
|
||
-Puppet registration
|
||
-
|
||
-=back
|
||
-
|
||
-=back
|
||
-
|
||
-=head2 COPYING THE BLOCK DEVICE
|
||
-
|
||
-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.
|
||
-
|
||
- virt-sysprep
|
||
- |
|
||
- v
|
||
- original guest --------> template ---------->
|
||
- \------> cloned
|
||
- \-----> guests
|
||
- \---->
|
||
-
|
||
-You can, of course, just copy the block device on the host using
|
||
-L<cp(1)> or L<dd(1)>.
|
||
-
|
||
- dd dd
|
||
- original guest --------> template ---------->
|
||
- \------> cloned
|
||
- \-----> guests
|
||
- \---->
|
||
-
|
||
-There are some smarter (and faster) ways too:
|
||
-
|
||
- snapshot
|
||
- template ---------->
|
||
- \------> cloned
|
||
- \-----> guests
|
||
- \---->
|
||
-
|
||
-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:
|
||
-
|
||
- virt-sysprep virt-sysprep
|
||
- (reset) (add user, keys, logos)
|
||
- | |
|
||
- dd v dd v
|
||
- original guest ----> template ---------> copied ------> custom
|
||
- template guest
|
||
-
|
||
-=over 4
|
||
-
|
||
-=item *
|
||
-
|
||
-Create a snapshot using qemu-img:
|
||
-
|
||
- qemu-img create -f qcow2 -o backing_file=original snapshot.qcow
|
||
-
|
||
-The advantage is that you don’t need to copy the original (very fast)
|
||
-and only changes are stored (less storage required).
|
||
-
|
||
-Note that writing to the backing file once you have created guests on
|
||
-top of it is not possible: you will corrupt the guests.
|
||
-
|
||
-=item *
|
||
-
|
||
-Create a snapshot using C<lvcreate --snapshot>.
|
||
-
|
||
-=item *
|
||
-
|
||
-Other ways to create snapshots include using filesystems-level tools
|
||
-(for filesystems such as btrfs).
|
||
-
|
||
-Most Network Attached Storage (NAS) devices can also create cheap
|
||
-snapshots from files or LUNs.
|
||
-
|
||
-=item *
|
||
-
|
||
-Get your NAS to duplicate the LUN. Most NAS devices can also
|
||
-duplicate LUNs very cheaply (they copy them on-demand in the
|
||
-background).
|
||
-
|
||
-=item *
|
||
-
|
||
-Prepare your template using L<virt-sparsify(1)>. See below.
|
||
-
|
||
-=back
|
||
-
|
||
-=head2 VIRT-CLONE
|
||
-
|
||
-A separate tool, L<virt-clone(1)>, can be used to duplicate the block
|
||
-device and/or modify the external libvirt configuration of a guest.
|
||
-It will reset the name, UUID and MAC address of the guest in the
|
||
-libvirt XML.
|
||
-
|
||
-L<virt-clone(1)> does not use libguestfs and cannot look inside the
|
||
-disk image. This was the original motivation to write virt-sysprep.
|
||
-
|
||
-=head2 SPARSIFY
|
||
-
|
||
- virt-sparsify
|
||
- original guest --------> template
|
||
-
|
||
-L<virt-sparsify(1)> can be used to make the cloning template smaller,
|
||
-making it easier to compress and/or faster to copy.
|
||
-
|
||
-Notice that since virt-sparsify also copies the image, you can use it
|
||
-to make the initial copy (instead of C<dd>).
|
||
-
|
||
-=head2 RESIZE
|
||
-
|
||
- virt-resize
|
||
- template ---------->
|
||
- \------> cloned
|
||
- \-----> guests
|
||
- \---->
|
||
-
|
||
-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 L<virt-resize(1)>. Virt-resize performs a copy and resize, and
|
||
-thus is ideal for cloning guests from a template.
|
||
-
|
||
=head1 FIRSTBOOT VS SCRIPT
|
||
|
||
The two options I<--firstboot> and I<--script> both supply shell
|