All Products
Search
Document Center

Alibaba Cloud Linux:Troubleshoot common Ext4 resizing errors

Last Updated:Jan 09, 2026

Ext4 is a widely used filesystem that supports online and offline resizing, as well as offline shrinking, to adapt to changing storage needs. However, you might encounter common errors when extending an Ext4 filesystem. This article uses the disk /dev/vdb as an example to explain how to identify and resolve these errors for a successful resize.

resize2fs: Bad magic number in super-block while trying to open /dev/vdb

Problem description

You run the following resize2fs command:

sudo resize2fs /dev/vdb

The command returns the following error:

resize2fs: Bad magic number in super-block while trying to open /dev/vdb
Couldn't find valid filesystem superblock.

Cause

This error indicates the specified device, /dev/vdb, is not an Ext4 filesystem.

Solution

Verify that the device uses the Ext4 filesystem type.

lsblk --fs /dev/vdb

resize2fs: Device or resource busy while trying to open /dev/vdb

Problem description

You run the resize2fs command.

sudo resize2fs /dev/vdb

The command returns the following error:

resize2fs: Device or resource busy while trying to open /dev/vdb
Couldn't find valid filesystem superblock.

Cause

This error typically occurs when the filesystem is on a partition, but you run the resize2fs command on the parent disk. For example, the filesystem is on partition /dev/vdb1, but you attempt to resize the parent disk /dev/vdb.

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vdb    253:16   0  100G  0 disk
└─vdb1 253:17   0   50G  0 part

Solution

  1. Extend the partition.

sudo growpart /dev/vdb 1

A successful command returns output similar to the following:

CHANGED: partition=1 start=2048 old: size=104855552 end=104857599 new: size=209713119 end=209715166
  1. Extend the file system.

sudo resize2fs /dev/vdb1

A successful command returns output similar to the following:

resize2fs 1.46.0 (29-Jan-2020)
Filesystem at /dev/vdb1 is mounted on /mnt/test; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/vdb1 is now 26214139 (4k) blocks long.

The filesystem is already 13106944 (4k) blocks long. Nothing to do!

Problem description

You run the resize2fs command.

sudo resize2fs /dev/vdb1

The command returns the following error:

The filesystem is already 13106944 (4k) blocks long.  Nothing to do!

Cause

This error indicates the filesystem already occupies all available space on its partition. This usually occurs if you try to extend a filesystem before extending its underlying partition.

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vdb    253:16   0  100G  0 disk
└─vdb1 253:17   0   50G  0 part

Solution

  1. Extend the partition.

sudo growpart /dev/vdb 1

A successful command returns output similar to the following:

CHANGED: partition=1 start=2048 old: size=104855552 end=104857599 new: size=209713119 end=209715166
  1. Extend the file system.

sudo resize2fs /dev/vdb1

A successful command returns output similar to the following:

resize2fs 1.46.0 (29-Jan-2020)
Filesystem at /dev/vdb1 is mounted on /mnt/test; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/vdb1 is now 26214139 (4k) blocks long.

resize2fs: On-line shrinking not supported

Problem description

You run the resize2fs command.

sudo resize2fs /dev/vdb

The command returns the following error:

Filesystem at /dev/vdb is mounted on /mnt/test; on-line resizing required
resize2fs: On-line shrinking not supported

Cause

This error indicates that Ext4 only supports offline shrinking.

Solution

  1. Check whether the device is mounted.

mount | grep /dev/vdb
  1. Unmount the file system.

sudo umount /mnt/test
  1. Run the resize2fs command again.

sudo resize2fs /dev/vdb 50G

A successful command returns output similar to the following:

Resizing the filesystem on /dev/vdb to 13107200 (4k) blocks.
The filesystem on /dev/vdb is now 13107200 (4k) blocks long.

resize2fs: Permission denied to resize filesystem

Problem description

You run the resize2fs command.

 resize2fs /dev/vdb

The command returns the following error:

resize2fs: Permission denied to resize filesystem

Cause

This error indicates either you lack the required permission (CAP_SYS_RESOURCE) to resize the filesystem, or the filesystem contains errors.

Solution

  1. Use sudo to elevate your permissions.

sudo resize2fs /dev/vdb
  1. If the issue persists, check the file system for errors.

dmesg | grep "EXT4-fs"
  1. If file system errors exist, unmount the file system and perform a file system check (fsck).

sudo umount /mnt/test
sudo fsck -y /dev/vdb
  1. Run the resize2fs command again to perform an offline resize.

sudo resize2fs /dev/vdb