I'm currently working on a physical-to-virtual (P2V) migration of a Debian Linux server. I've created a complete dd image of the 1 TB disk and converted it to VDI using vboxmanage, but I've encountered a major issue: since the operating system only uses about 30 GB of space, I ended up with over 900 GB of empty space in the VDI. I tried using dd to copy just the EFI and root partition by specifying the end sector of the root partition, but that approach didn't work either. I'm looking for a more efficient solution to minimize the size of the VDI without resorting to virt-p2v. Any suggestions?
6 Answers
There are plenty of methods to achieve this. Clonezilla could be a good choice as it offers remote targets and is partition-aware, meaning it should only copy the data that's necessary. If your virtualization solution supports thin provisioning, that could help reduce the data you need to transfer, skipping the image creation step entirely.
You should consider shrinking the partition before running dd to make the image smaller. That way, you'll only be copying the necessary data.
What platform are you virtualizing to? There might be better tools or methods that can simplify this process.
I'm using Proxmox for the VMs.
I recommend checking out Starwind’s P2V tool. It’s free and can make this migration process a lot smoother for you!
Thanks for the tip! I hadn't heard about that tool before!
The issue with dd is that it operates at the block level and doesn't distinguish between used and unused space. So when you clone the disk, it includes all that extra space you're trying to avoid.
Yeah, I've learned way more about dd and its speed limitations than I ever expected!
You can keep it simple! Just manually set up the partition structure on the new installation and create a tarball of your existing filesystem. Be sure to exclude directories like /sys and /proc.
So, are you suggesting to just place the backed-up filesystem over a fresh installation?

I tried that approach, but it messed up the disk UUID and the VM wouldn’t boot.