I have a 64GB GPT disk image file with multiple partitions. I shrank the last (and the largest) partition and now have a free space of 32GB at the end.
Now I'd like to shrink the entire image file. If I simply run
Probably I can create another (dummy) GPT disk image of 32GB, create the same partitions as on the original one, make a backup (with gpart) and then run
Am I missing something obvious?
Now I'd like to shrink the entire image file. If I simply run
truncate -s 32g disk.img
, gpart doesn't like it and reports "No such geometry", although I hoped I could use gpart recover ...
.Probably I can create another (dummy) GPT disk image of 32GB, create the same partitions as on the original one, make a backup (with gpart) and then run
gpart restore ...
on the original image using the backup data from the dummy image. Not an elegant way (and requires additional disk space).Am I missing something obvious?