Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

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

2 Answers

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.

share|improve this answer
    
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. –  Joshua Robison Jun 6 '11 at 1:55
    
your answer will not work because I need to preserve the boot information. –  Joshua Robison Jun 6 '11 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 '11 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. –  Joshua Robison Jun 6 '11 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. –  Joshua Robison Jun 6 '11 at 14:15
add comment

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.

share|improve this answer
    
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 –  Joshua Robison Jun 7 '11 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. –  Joshua Robison Jun 7 '11 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 '11 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? –  Joshua Robison Jun 7 '11 at 14:24
    
@Joshua Robison, it most certainly will, IF it is an image of an ext[234] filesystem. –  psusi Jun 7 '11 at 17:49
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.