Notes completed for kvm cloning

This commit is contained in:
2025-12-07 13:29:48 +13:00
parent ce332cd791
commit 9e9efba5c3

View File

@@ -3,4 +3,82 @@
*Prep*
Install the base OS.
Install all required apps
* openssh-server
Install all required updates
Shutdown guest
* virsh shotdown $guest-vm
On the VM Host server make sure you have libgustsfs-tools
```
apt list --installed |grep -i libguestfs-tools
```
if its not there, install it.
```
sudo apt install libguestfs-tools
```
This step strips stuff that must be unique per VM (machine-id, SSH keys, etc.) from the *template*.
```
sudo virt-sysprep -d $guest-vm \
--operations machine-id,ssh-hostkeys,udev-persistent-net,logfiles,tmp-files
```
Your output should be similiar to the following:
```
sudo virt-sysprep -d Debian-Base --operations machine-id,ssh-hostkeys,udev-persistent-net,logfiles,tmp-files
[ 0.0] Examining the guest ...
[ 17.4] Performing "logfiles" ...
[ 17.6] Performing "machine-id" ...
[ 17.6] Performing "ssh-hostkeys" ...
[ 17.6] Performing "tmp-files" ...
[ 17.6] Performing "udev-persistent-net" ...
```
The base is now ready to go.
**Create Clone**
sudo virt-clone --original $guest-vm \
--name guest-01 \
--auto-clone
example
```
sudo virt-clone --original Debian-Base \
--name Node01 \
--auto-clone
Allocating 'Node01.qcow2' | 1.6 GB 00:00:03 ...
Clone 'Node01' created successfully
```
Confirm your clones have been made
```
virsh list --all
Id Name State
---------------------------------
1 downloads running
- Debian-Base shut off
- k8s-node1 shut off
- k8s-node2 shut off
- k8s-node3 shut off
- k8s-node4 shut off
- k8s-node5 shut off
- Node01 shut off
- Node02 shut off
- Node03 shut off
- Node04 shut off
- Node05 shut off
- Ubuntu_Default shut off
```