How to resize an IMG file’s partition info

filesystemsisopartitionsize;

I made an ISO this way: sudo partimage save /dev/sdc1 /media/56AE8240AE82191F/Backup/xfcefat.iso

The resulting iso file is very small but when mounted I see that it has correctly preserved the partition information.

The problem is my partition was 8gigs and only had like 100mb of data on it.

I want to fix the partition information on the iso and tell it to think it is only a 500mb partition.

How can I shrink it's partition information?

If it was a usb drive I could do this with gparted and shrink it just fine. But this is an iso file raw copy clone of my disk.

Best Answer

You could simply re-create the image "from scratch" with mkisofs.

$ mkisofs -o new_image_name /path/to/the/mounted/dvd

If you don't have the CD-ROM available anymore, loop-mount the iso image with:

$ sudo mount -o loop /media/disk/linux.iso /path/to/the/mounted/dvd

(And don't forget to unmount it.)

This will not copy boot information from the DVD. If you need that, a little more work is necessary to extract to boot information and pass it as an option to mkisofs.

Related Question