Skip to content

Instantly share code, notes, and snippets.

@ivmm
ivmm / decloudify_image
Created May 9, 2019 07:10 — forked from remoteur/decloudify_image
decloudify_image
yum install -y libguestfs-tools
virt-filesystems --long -h --all -a rhev-m.init.qcow2
truncate -r rhev-m.init.qcow2 rhev-m.qcow2
truncate -s +100G rhev-m.qcow2
virt-resize --expand /dev/sda1 rhev-m.init.qcow2 rhev-m.qcow2
virt-customize -a rhev-m.qcow2 --root-password password:<pass>
virt-customize -a rhev-m.qcow2 --run-command 'yum remove -y cloud-init'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PasswordAuthentication.*/PasswordAuthentication\ yes/ /etc/ssh/sshd_config'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config'