Re: How to create an image file system that grows
T o n g wrote:
> Hi,
>
> How can I create an image file system that can grow bigger as required?
>
> Vmware, qemu, kvm, etc all can create file systems in an image file which
> is initially small, but grow bigger as required. I want to do that too,
> but
>
> dd if=/dev/zero of=file-fs.ext2 bs=1k count=20k
> mke2fs file-fs.ext2
>
> would only create an image file initially as big as the full size.
>
> please help, thanks
>
With this you cannot automagically grow the filesystem every time it runs out
of space but hope this helps even a bit:
1. Backup and umount the container file
2. Add enough space to the container file (in this example 8 MiB)
dd if=/dev/zero of=file-fs.ext2 bs=8M count=1 conv=notrunc oflag=append
3. Check the filesystem
e2fsck -f file-fs.ext2
4. Resize filesystem
resize2fs file-fs.ext2
5. Enjoy our extra megabytes.
--
Juha Tuuna
Reply to: