Skip to content

Instantly share code, notes, and snippets.

@poespas
Last active October 12, 2025 15:12
Show Gist options
  • Select an option

  • Save poespas/3596bac5e43177f31cbf47fc40b33412 to your computer and use it in GitHub Desktop.

Select an option

Save poespas/3596bac5e43177f31cbf47fc40b33412 to your computer and use it in GitHub Desktop.
Transform an physical disk into a VM

Boot with a LiveUSB

Run command on the LiveUSB environment:

sudo dd if=/dev/nvme0n1 bs=256M status=progress | pigz -c -p 4 | ssh [user]@[host] "gunzip -c > /mnt/disks/dev-nvme0n1.img"

Convert disk to qcow2 format

$ qemu-img convert -f raw -O qcow2 /mnt/disks/dev-nvme0n1.img /mnt/disks/dev-nvme0n1.qcow2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment