Quote Originally Posted by mark.johnson
Is it possibly to resize a persistant disk image?
Yes. You can resize (shrink and grow) a persistent disk image (PDI) using a combination of dd, e2fsck, and resize2fs. For example, say you have a 200 MB knoppix.img file with only 100 MB of content on /dev/hda1. You want to shrink the image to 110 MB so that the image still has a little bit of room. Here's how:
  • boot: knoppix -b
    mkdir /mnt/hda1
    mount /dev/hda1 /mnt/hda1
    cd /mnt/hda1
    e2fsck -pf knoppix.img
    resize2fs knoppix.img 102M
    dd of=knoppix.img bs=1 count=0 seek=110M
    e2fsck -pf knoppix.50.img
    resize2fs -f knoppix.img
    e2fsck -pf knoppix.50.img
    cd
    umount /mnt/hda1
    rmdir /mnt/hda1
    exit
To expand by 10 MB:
  • boot: knoppix -b
    mkdir /mnt/hda1
    mount /dev/hda1 /mnt/hda1
    cd /mnt/hda1
    dd if=/dev/zero bs=1M count=10 >> knoppix.img
    e2fsck -pf knoppix.img
    resize2fs -f knoppix.img
    cd
    umount /mnt/hda1
    rmdir /mnt/hda1
    exit

The -b option to Knoppix boots linux into "emergency mode" which is before any PDI is mounted. This allows you to boot linux, make changes to the image (or anything else), and then continue booting with the new image.

For more details, see:
http://lists.firepipe.net/pipermail/...ay/002604.html
http://lists.firepipe.net/pipermail/...ay/002633.html

Note: Be very careful with the dd comand. One slip up and your data is gone. You may want to make a backup of any images just in case.

Quote Originally Posted by mark.johnson
Is it possible to copy the contents of one image to another?
Yes. Mount both images via the loopback device and then copy. For example, say you want to copy file "foo" from knoppix.01.img to knoppix.02.img:
  • boot: knoppix -b
    mkdir /mnt/hda1 /mnt/img.1 /mnt/img.2
    mount /dev/hda1 /mnt/hda1
    cd /mnt/hda1
    mount -o loop knoppix.01.img /mnt/img.1
    mount -o loop knoppix.02.img /mnt/img.2
    cp -a /mnt/img.1/home/knoppix/foo /mnt/img.2/home/knoppix
    cd
    umount /mnt/hda1 /mnt/img.1 /mnt/img.2
    rmdir /mnt/hda1 /mnt/img.1 /mnt/img.2
    exit

Good luck and let us know how things go.

Regards,
- Robert
http://www.cwelug.org/