How to extend the size of an image

In linux, it is possible to extend the size of a disk image without losing already existed content.
For example, to extend rootfs image to a fixed 1GB size:

dd if=/dev/zero of=rootfs.ext2 bs=1M seek=1000 count=0
e2fsck -f rootfs.ext2
resize2fs rootfs.ext2

Leave a Reply

Your email address will not be published. Required fields are marked *