Another shell snippet I'm looking for regularly...
To resize a block image file (like those that are used as virtual disks in Xen) from 2GB to 10GB you need the following. The used filesystem is ext2/3.
dd if=/dev/zero of=<image file> bs=1M conv=notrunc count=1 seek=10000 losetup /dev/loop0 <image file> e2fsck -f /dev/loop0 resize2fs /dev/loop0 e2fsck -f /dev/loop0 losetup -d /dev/loop0
Update: newer versions of e2fsck and resize2fs can handle image files natively, so you don't have to setup a loopback device. The new variant is therefore shorter:
dd if=/dev/zero of=<image file> bs=1M conv=notrunc count=1 seek=10000 e2fsck -f <image file> resize2fs <image file> e2fsck -f <image file>
Trackback URL for this post:
http://lepetitfou.dyndns.org/home/trackback/63
Post new comment