GrepBoard/Manuals
605 manuals ·

Fix resize2fs "Bad magic number in super-block" on XFS

·Tested on Ubuntu 24.04 (Docker) · e2fsprogs 1.47.0 · xfsprogs 6.6.0 · 2026-10·Test scope ↓·5 steps

resize2fs "Bad magic number in super-block" means the target is not ext4, usually XFS. Check the type with df -hT, then run xfs_growfs on the mount point.

output
resize2fs 1.47.0 (5-Feb-2023)Couldn't find valid filesystem superblock.resize2fs: Bad magic number in super-block while trying to open xfs.img

resize2fs only handles ext2, ext3, and ext4, and the target is not one of them, so it could not read the superblock. If you see this after enlarging a disk, it is usually XFS (the default on Rocky and RHEL). Nothing is corrupted, so do not run fsck. Check the type, and for XFS run xfs_growfs with the mount point. The AWS EBS docs explain this message the same way: the file system is not Ext4.

[1] Check the file system type and mount point.

console
$ df -hTFilesystem      Type  Size  Used Avail Use% Mounted on/dev/nvme0n1p1  xfs   8.0G  1.6G  6.5G  20% //dev/nvme1n1    xfs   8.0G   33M  8.0G   1% /data

(Example output from the AWS docs.)

Type xfs means you are in the right place. For devices that are not mounted, use lsblk -f or blkid:

console
$ blkid xfs.img ext4.imgxfs.img: UUID="…" BLOCK_SIZE="512" TYPE="xfs"ext4.img: UUID="…" BLOCK_SIZE="4096" TYPE="ext4"

If it says TYPE="ext4" and you still get the error, you passed the wrong device. Check with lsblk whether you gave the whole disk (/dev/nvme0n1) instead of the partition (/dev/nvme0n1p1) or the LVM logical volume.

[2] If there is a partition, grow it first. When only the disk grew and the partition did not, there is no room for the file system. Compare disk and partition sizes in lsblk; if the partition is smaller, grow it with growpart. Note the space between the device name and the partition number:

console
$ sudo growpart /dev/nvme0n1 1

[3] For XFS, give xfs_growfs the mount point. A device name or an unmounted image fails:

console
$ sudo xfs_growfs -d /data
output
xfs_growfs: xfs.img is not a mounted XFS filesystem

This appears when the mount point is wrong, the file system is not mounted, or it is not XFS. Use the Mounted on value from df -hT as is. XFS can only be grown while mounted. If it already fills the disk you get data size unchanged, skipping; go back to the partition in step 2.

[4] If it was ext4 after all, give resize2fs the device name. ext4 can grow while mounted.

console
$ sudo resize2fs /dev/nvme0n1p1

When nothing changed it ends like this; again, check that the partition or disk actually grew:

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

[5] For file systems on LVM there is a way that does not care about the type: lvextend -r grows the logical volume and then the file system on it. The full steps are in Extend an LVM logical volume into the free space of its VG. If df is still full after growing, continue with Find what is using the space when a disk is full.

When you are done, confirm with df -hT that the size matches the disk.

#resize2fs#xfs#xfs_growfs#disk