2021-04-27 12:07:30 -04:00
|
|
|
# virt-sysprep
|
|
|
|
|
|
|
|
> Reset, unconfigure, or customize a virtual machine image.
|
|
|
|
> More information: <https://manned.org/virt-sysprep>.
|
|
|
|
|
|
|
|
- List all supported operations (enabled operations are indicated with asterisks):
|
|
|
|
|
|
|
|
`virt-sysprep --list-operations`
|
|
|
|
|
2025-02-06 18:26:04 +02:00
|
|
|
- Remove sensitive system data from a virtual machine image:
|
2021-04-27 12:07:30 -04:00
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sudo virt-sysprep {{[-a|--add]}} {{path/to/image.qcow2}}`
|
2025-02-06 18:26:04 +02:00
|
|
|
|
|
|
|
- Specify a virtual machine by its name and run all enabled operations but don't actually apply the changes:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sudo virt-sysprep {{[-d|--domain]}} {{vm_name}} {{[-n|--dry-run]}}`
|
2021-04-27 12:07:30 -04:00
|
|
|
|
|
|
|
- Run only the specified operations:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sudo virt-sysprep {{[-d|--domain]}} {{vm_name}} --operations {{operation1,operation2,...}}`
|
2021-04-27 12:07:30 -04:00
|
|
|
|
|
|
|
- Generate a new `/etc/machine-id` file and enable customizations to be able to change the host name to avoid network conflicts:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sudo virt-sysprep {{[-d|--domain]}} {{vm_name}} --enable {{customizations}} --hostname {{host_name}} --operation {{machine-id}}`
|
2025-03-26 00:36:41 +02:00
|
|
|
|
|
|
|
- Display help:
|
|
|
|
|
|
|
|
`virt-sysprep {{[-he|--help]}}`
|