Jump to content

Resize img file created with qemu-img


Recommended Posts

I used qemu-img to create an img file of my high sierra usb install and that worked fine

The problem is I used a 32GB USB because that is all I had laying around and now the img file is 30GB

Can it be resized down to 8GB or so

How would I go about doing this?



Link to comment

I don't know the direct answer, but I can give you some direction as to what to look for.


An image file that has been well used likely has at least some dirty data across the whole file, even if it's not currently all "used". To clean it up, you have to defragment the filesystem that is contained in the image, then write zeroes to all unused file system space. After that is done, you can typically shrink the partition inside the image freeing up the remainder of the image file to be shrunk.


It would likely be easier to make a full backup of the files contained in the image, then restore them to a smaller image file.


Hopefully someone else will have an easier solution.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...