resize2fs(8)
Resize an ext2, ext3, or ext4 filesystem to a new size.
Synopsis
resize2fs [OPTION]... DEVICE [NEW_SIZE]Description
resize2fs is used to resize ext2, ext3, and ext4 filesystems. It can grow or shrink a filesystem to a specified size, or automatically resize it to fit the current block device. The filesystem must be unmounted or mounted read-only during resizing (except when growing online with the -f flag on supported kernels).
When expanding a filesystem, the inode table and block group descriptors are relocated as needed. When shrinking, files must have sufficient free space after the new size to avoid data loss. Always backup your data before resizing.
Common options
| Flag | What it does |
|---|---|
-f | Force online resize even if errors are detected; allows growing mounted filesystems on newer kernels |
-p | Print progress information while resizing (useful for large filesystems) |
-M | Shrink the filesystem to the minimum size required to hold existing files |
-P | Print expected filesystem blocks as would result from resize without making changes |
-S | Deprecated in newer versions; use resize2fs without this for standard behavior |
-b | Specify blocksize for filesystem (usually auto-detected) |
-z UUID | Create a new UUID when resizing (useful for duplicated filesystems) |
Examples
Resize the filesystem on /dev/sda1 to exactly 50 gigabytes
resize2fs /dev/sda1 50GAutomatically resize /dev/sda1 to fill the entire block device (grow to available space)
resize2fs /dev/sda1Shrink /dev/sda1 to the minimum size needed for existing data
resize2fs -M /dev/sda1Resize /dev/sda1 to 100GB and display progress during the operation
resize2fs -p /dev/sda1 100GGrow /dev/sda1 by an additional 10 gigabytes
resize2fs /dev/sda1 +10GPreview the operation (print expected blocks) without actually resizing
resize2fs -P /dev/sda1 80GUnmount, shrink to 30GB, then remount the filesystem
umount /dev/sda1 && resize2fs /dev/sda1 30G && mount /dev/sda1 /mnt