ext2online

NAME

SYNOPSIS

DESCRIPTION

The ext2online tool resizes ext2 file systems while they are mounted
and in use by the system. It is OK to resize the filesystem even while
programs have open files and are writing into the filesystem. It is
only possible to enlarge a mounted filesystem. To be able to use
ext2online, you need to have the Onlineext2resizesupport (CON-FIG_EXT2_RESIZE) feature enabled in the kernel (after applying the
appropriate patch for the 2.x series of kernels).
The filesystem specified by device (partition, loop device, logical
volume, ...) or mountpoint must currently be mounted, and it will be
enlarged to fill the device, by default. If the optional size parame-
ter is specified, then this size will be used instead. If the size
parameter does not have an optional modifier, it will be taken to be in
ext2 filesystem blocks (which can be 1k, 2k, or 4k - use dumpe2fs(8)
to find out more information about the current filesystem). The modi-
fiers b, K, M, G, or T mean the size parameter is given in 512-byte
blocks, kilo-, mega-, giga-, or terabytes respectively.
The ext2online program does not change the size of the actual device -
only the filesystem. If you wish to enlarge a filesystem, you must
make sure you expand the underlying device first. This can be done
online for Logical Volumes by using lvextend(8) from the LVM package,
or for ease-of-use you can use e2fsadm(8) which combines the LV exten-
sion and ext2 filesystem resizing into one step. Alternately, you may
be able to use facilities in md or RAID facilities in the hardware, if
you are not using a partition table. It is not possible to do this by
using the fdisk(8) family of tools to extend a partition while it is
mounted (at least the author has not been able to successfully do
this).
Because of the original design of the ext2 filesystem did not have
online resizing in mind, there are certain limitations to the amount of
resizing that can be done while the filesystem is mounted, if you
haven’t done any preparation for the resize. The default block size
for ext2 was 1k blocks until v1.15 of e2fsprogs (1999), where it
changed to 4k blocks for filesystems larger than 512MB.
With no filesystem preparation, it is always possible to resize to the
next 256MB boundary for 1k filesystems, the next 2GB boundary for for
2k filesystems, and the next 16GB boundary for 4k filesystems.

EXAMPLES

The following example shows how to test ext2online with a spare parti-
tion. First a filesystem of 32MB is created on the device, mounted,
and the size is verified. The filesystem is then extended to fill the
device (the default action when no size is given), and the new size is
verified.
dd if=/dev/zero of=/tmp/file bs=1k count=64k
mke2fs -f /tmp/file 32768
mkdir /mnt/test
mount -o loop,debug,check=strict /tmp/file /mnt/test
df /mnt/test
ext2online -d -v /tmp/testfile
df /mnt/test
By using the debug and check=strict options to mount, as well as the -d
and -v flags to ext2online, we will see the user-space status messages,
and the kernel messages will be logged by syslog.

WARNING

Note that resizing a mounted filesystem is inherently dangerous and may
corrupt filesystems, although no errors resulting in data loss have
ever been reported to the author. In theory online resizing should
work fine with arbitrarily large filesystems, but it has not yet been
tested by the author on a filesystem larger than 11GB. Usewithcau-tion. Backups are always a good idea, because your disk may fail at
any time, you delete files by accident, or your computer is struck by a
meteor.

AUTHOR

The ext2online program was written by Andreas Dilger <adilger@clus-
terfs.com> using the ext2 resizing tools developed by Lennert Buytenhek
<buytenh@gnu.org>. The ext2online kernel patches are available as part
of the GNU ext2resize package at <http://source-
forge.org/projects/ext2resize/>.

BUGS

There is a limit imposed on a single filesystem resize due to the fact
that ext2online does not use triple-indirect blocks for the resize
inode. This should not affect most users of ext2online, as the limit
is about 60GB larger than the current filesystem size for 1k block
filesystems.

COPYRIGHT

ext2online is (C) Copyright 1999, 2000, 2001 by Andreas Dilger and may
be distributed under the terms of the GNU General Public License.