ext2/ext3/ext4 file system resizer

resize2fs [ -fFpPMbs ] [ -d debug-flags ] [ -S RAID-stride ] [ -z undo_file ] device [ size ]

Resizes ext2, ext3, or ext4 file systems. enlarge or shrink an unmounted file system
If the filesystem is mounted, it can expand the size. The size specifies the requested new size of the filesystem suffixed by the units designators: 's', 'K', 'M', or 'G', for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively. kilobytes is power-of-2 kilobytes, (i.e., 1024 bytes),
If no units are specified, size is the blocksize of the filesystem.
The size of a filesystem can not be larger than the size of the partition.
If size parameter is not specified, it will default to the size of the partition

Does not change the size the partition.
To enlarge a filesystem, expand the size of the underlying partition first.
This can be done using fdisk by deleting the partition and recreating it. If using the logical volume manager lvm use lvextend. When recreating the partition, use the same starting disk cylinder as before!
After running fdisk, run resize2fs

To shrink an ext2 partition, first use resize2fs to shrink the size of filesystem. Then use fdisk to shrink the size of the partition. do not make it smaller than the new size of the ext2 filesystem!

-d flagsdebug flags. Computed by adding the numbers of the flags (all 2+4+8+16+32= 3E = 62
  •  2 - block relocations
  •  4 - inode relocations
  •  8 - moving the inode table
  • 16 - Print timing information
  • 32 - minimum filesystem size calculation
  • -f Forces overriding some safety checks
    -F Flush the filesystem device's buffer caches before beginning. Only really useful for doing resize2fs time trials.
    -M Minimize the file system size
    -P Print an estimate of the number of file system blocks in the file system if it is shrunk and exit.
    -p Prints out a percentage completion bars for each operation during an offline resize,
    -b Turns on  the 64bit feature, resizes the group descriptors , and moves other metadata
    -s Turns off the 64bit feature and frees blocks that are no longer in use.
    -S RAID-stride heuristically determine the RAID stride that was specified when the filesystem was created. This option allows the user to explicitly specify a RAID stride setting to be used by resize2fs instead.
    -z undo_file Before overwriting a file system block, save the old contents . This undo file can be used with e2undo(8) to restore the old contents of the file system. Default resize2fs-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable.

    Cannot be used to recover from a power fail. reset or system crash.

    KNOWN BUGS The minimum size as estimated by resize2fs may be incorrect, especially for filesystems with 1k and 2k blocksizes.

    AUTHOR resize2fs was written by Theodore Ts'o .

    COPYRIGHT Resize2fs is Copyright 1998 by Theodore Ts'o and PowerQuest, Inc. All rights reserved. As of April, 2000 Resize2fs may be redistributed under the terms of the GPL.

    SEE ALSO fdisk(8), e2fsck(8), mke2fs(8), lvm(8), lvextend(8)