4

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.

3
  • Do you get the same result if you do cat /dev/sdc2 > /media/disk/linux.iso?
    – boehj
    Jun 5, 2011 at 12:45
  • How did you create sdc2 content ?
    – jlliagre
    Jun 5, 2011 at 12:45
  • You didn't create an ISO in the first place.
    – jlliagre
    Jun 7, 2011 at 3:54

2 Answers 2

5

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.

5
  • I rephrased the question. I don't think it was understandable. I need to resize the iso's partition information to make it think it is a smaller partition because it only has a small amount of data on it. Jun 6, 2011 at 1:55
  • your answer will not work because I need to preserve the boot information. Jun 6, 2011 at 1:56
  • you radically changed the question from a 8G ISO dumped with dd that only had 2G data, to a few hundred meg image... I'm not even sure I understand your new question
    – Mat
    Jun 6, 2011 at 5:08
  • by resize the iso, i always meant make the partition info on it smaller.i just didnt know how to say it. im learning as i go. Jun 6, 2011 at 14:11
  • i need to do this if i want to be able to quick clone my drive bootable on a smaller disk any time i want to. messing with boot loader info is not an option. what do big schools do who want linux on all their machines? they're not gonna install it on each individual one. their gonna clone one drive on all. and some computers drives are smaller. what to do then? i cant believe im the first one trying to do this? they're not gonna go back and install bootloaders on each individual one either. Jun 6, 2011 at 14:15
1

ISO is short for iso9660, the filesystem type used on CDROMs. Filesystems do not know or care about partitions, and cdroms do not have partitions. Since you copied a partition, then it likely is not an iso9660 filesystem at all, so you have named the file incorrectly. Instead of an iso image, you have an image of whatever filesystem was in that partition. How to resize it depends on what the type of filesystem is. If it is an ext[234] filesystem, then you can resize it with resize2fs.

10
  • one is fat32. one is ext3. when they are named .iso they mount by right clicking on them. iso or img, i will try out resize2fs Jun 7, 2011 at 10:51
  • wait a second resize2fs does not resize img file's partition info at all. it only resizes real media like usb drives or HDs O_o that would be useless to me. Jun 7, 2011 at 10:56
  • @Joshua Robison no, it reiszes filesystems. Once again, filesystems do not know or care about partitions. A partition is only a container that may or may not contain a filesystem.
    – psusi
    Jun 7, 2011 at 13:48
  • no matter what you say, resize2fs is not going to resize my img files, filesystem smilesystem, so why did you post it as an answer to my question about how to resize an IMG FILE'S partition info? Jun 7, 2011 at 14:24
  • @Joshua Robison, it most certainly will, IF it is an image of an ext[234] filesystem.
    – psusi
    Jun 7, 2011 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .