old 1.0 code (unmaintained)

The online ext2 resize patch allows you to "safely" growing of an ext2 filesystem WHILE IT IS MOUNTED. The growth of the filesystem can happen while the FS is in use, with open files, and no impact to programs reading from or writing to the filesystem. I only quote "safely" because the patch is not in widespread use, so there may be some unresolved issues with the patch. I'm especially not responsible for people without a backup - always a good idea even when not doing things like this.

There are patches available for 2.0, 2.2, 2.4, and 2.6. The actual functionality of the patch hasn't changed much since its inception.

The ext2 online patch DOES NOT give you the ability to resize DOS partitions (i.e. partitions you made with fdisk or similar). You need to be using something like a Logical Volume Manager( LVM) for Linux, or MD RAID devices, or hardware RAID units (or for testing, loopback and not-full-size filesystems on larger partitions).

Examples of using ext2online with a mounted filesystem under load and with LVM.

  1. With a patched kernel you can:
    Grow ANY mounted ext2 FS to the end of a group (8MB for 1k blocks, 128MB for 4k blocks) without any tools besides the kernel patch (using mount -o remount,resize=size device).
  2. With the ext2online tool + patched kernel you can:
    Grow any mounted ext2 FS to the end of EXT2_DESC_PER_BLOCK groups (normally 256MB for 1k blocks, 16GB for 4k blocks) without having to unmount the filesystem. This again works on any normal ext2 filesystem when you have the patched (19991014 or later, or 20000226 or later for sparse filesystems) kernel running. The ext2online tool will create group descriptors, and groups in the new areas of the disk without touching the running filesystem, and then the online kernel resize will start using these new groups.
  3. With the ext2prepare + ext2online tools + patched kernel you can:
    Grow a mounted prepared filesystem to the limits of what you prepare for (up to 2 TB). The reason for the "prepared" part is the need to add a group descriptor block after the next multiple of 32/128 groups are used up. The ext2prepare filesystem moves the metadata around in an unmounted filesystem so that you can increase the number of group descriptor blocks in a mounted filesystem when you need to. Since each reserved block will give 256MB, 4GB, or 16GB for 1k, 2k or 4k block sizes respectively, not much space needs to be reserved in order to grow for most needs. It is good to note that a "prepared" filesystem is still a legal ext2 filesystem in every way, so it is possible to use it with an unpatched kernel.


Let me know of any issues at all with the patch. Testing wise, I've been running resizes every few seconds on a filesystem while simultaneously copying 11 MB/1500 files into the filesystem into a new directory each time. This goes on for several hours (thousands of +2MB or +random resizes) until I fill the disk with many thousands of files (1GB worth). No problems with the latest patches.

The 2.0 patch is not currently maintained. If there is real demand for it, a new patch could be made. However, it would also be easy (if you really need it) to manually apply the 2.2 patch to the 2.0 kernel, since they are nearly identical for the code in question.
Latest 2.0 patch: online-ext2-2.0-19991014.diff

Old patches available

(and why they were replaced)

Thanks to Miguel de Icaza for his ext2volume patch for the basis for this work. While he worked with whole disks, I can use LVM or MD to handle the growth for me (meaning less kernel mods), and I'm left with a single normal filesystem afterwards. The other plus of my patch is that the resize code path is only used at resize time, whereas Miguel's was used for each block access, much like LVM, so there was more overhead.
Andreas Dilger <adilger AT users DOT sourceforge DOT net>