Question: how to resize KVM .RAW to VHDX dynamically expanding

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

EloquentSrv

New Member
Jan 21, 2014
7
0
0
I made a fairly significant misjudgement in making a .RAW KVM image. Seems like I could have made a much smaller disk:

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 15G 2.1G 12G 15% /
tmpfs 5.9G 0 5.9G 0% /dev/shm
/dev/vda3 24G 2.8G 20G 13% /home

I want to test this disk on my Windows 8.1 laptop's Hyper-V BUT I do not want to use 40GB of my 110GB total. I have only 48GB free.

Does anyone have a program or trick to resize the KVM .RAW file?
 

Jeggs101

Well-Known Member
Dec 29, 2010
1,529
241
63
Here is what I would do:
- Download the big 40GB image and mount in a VM (sda)
- Make a vhdx on a USB drive or something and mount in the same VM (sdb)
- dd if=/dev/sda of=/dev/sdb
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,514
5,805
113
Hey the STH wordpress Disk was 42GB so close. I changed the extension from .raw to .img. I then used the StarwindV2V to go from .img to .vhd. I had a similar initial fill rate at about 16% and it went down to 27GB. I then compacted with no change. Then I converted to VHDX and got just over 29GB.