Online resizing of ext3 filesystems {shrink}

Bill Rugolsky Jr. brugolsky at telemetry-investments.com
Sun Jan 8 18:23:13 UTC 2006


On Sun, Jan 08, 2006 at 09:13:21AM -0600, Justin Conover wrote:
> Can you currently shrink an ext3 lvm online?

To elaborate on Arjan's answer: no, and not very likely in the near-term.
Expanding a file system is relatively easy, because the new space is
not referenced by any existing filesystem user.  It is a relatively
simple matter to prepare the data structures (block group, free map,
etc.) and then update the existing data structures to include the new
free space.  The last step is very quick, and does not require suspending
normal filesystem operations for very long.

Shrinking, on the other hand, presents a host of problems, including
the need to compact the data below the new boundary, and deal with
current users of the filesystem that may, e.g., have a region of
some file memory-mapped, or may have I/O in flight.

A number of years ago, Andrew Morton (ioctl() to move file blocks),
Jeff Garzik (ext2meta), and others experimented with APIs suitable for
online defragmentation/optimization, the necessary first step before a
filesystem can be shrunk.  [Details are available in the ext2-devel and
ext3-users archives.]  But nobody ever bothered to write the userland
code for an online defragmenter.

Regards,

	Bill Rugolsky




More information about the fedora-test-list mailing list