resize2fs: commnd not found

The resize2fs command is used to enlarge or shrink an ext2/3/4 file system on a device. You can enlarge a mounted file system, but you must unmount the file system before you can shrink it. You can specify the desired size of the file system in order to either enlarge or shrink it. If you don’t specify a size, the file system will be resized to the same size as the partition.

It’s important to note that resize2fs does not resize partitions, only the file system. You must use a command like fdisk or an LVM tool to expand the size of the partition/ volume first in order to then enlarge the file system.

Syntax

The syntax of the resize2fs command is:

# resize2fs [options] {device/file system name} [desired size]

If you encounter the below error while running the resize2fs command:

resize2fs: command not found

you may install below package as per your choice of distribution:

Distribution Command
OS X brew install e2fsprogs
Debian apt-get install e2fsprogs
Ubuntu apt-get install e2fsprogs
Alpine apk add e2fsprogs
Arch Linux pacman -S e2fsprogs
Kali Linux apt-get install e2fsprogs
CentOS yum install e2fsprogs
Fedora dnf install e2fsprogs
Raspbian apt-get install e2fsprogs

resize2fs Command Examples

1. To resize a recently extended file system:

# resize2fs /dev/mapper/VG02-LV05 

2. To forcefuly resize the file system:

# resize2fs -f /dev/mapper/VG02-LV05 

3. To flush the filesystem device’s buffer caches:

# resize2fs -F /dev/mapper/VG02-LV05 

4. To shrink the filesystem to the minimum size:

# resize2fs -M /dev/mapper/VG02-LV05 

5. To prints out a percentage completion bars for each resize2fs operation:

# resize2fs -p /dev/mapper/VG02-LV05 

6. To Print the minimum size of the filesystem and exit:

# resize2fs -P /dev/mapper/VG02-LV05 
Related Post