dumpe2fs Command in Linux (ext4 Superblock & Recovery Guide)

dumpe2fs Command in Linux (ext4 Superblock & Recovery Guide)

Tested on Ubuntu 22.04 / 24.04 and Debian 12 using the default dumpe2fs package

What is dumpe2fs Command?

The dumpe2fs command is a Linux utility used to display detailed filesystem metadata, including superblock and block group information. It is part of the e2fsprogs package and works with:

  • ext2
  • ext3
  • ext4

System administrators commonly use dumpe2fs to inspect filesystem properties such as UUID, block size, inode count, mount count, and backup superblock locations.

Although dumpe2fs can run on a mounted filesystem, the output may be inconsistent if the filesystem is actively in use. For accurate results, it is recommended to unmount the device before running the command.

Unlike tune2fs, which modifies filesystem parameters, dumpe2fs only displays metadata. Compared to debugfs, which provides low-level filesystem debugging, dumpe2fs focuses on structured metadata reporting.


dumpe2fs Syntax

The basic syntax of the dumpe2fs command is:

bash
sudo dumpe2fs [options] device

Example:

bash
sudo dumpe2fs /dev/sdc1

Where:

  • device refers to the partition containing the ext filesystem.
NOTE
When dumpe2fs is run on a mounted filesystem, some metadata values may not reflect the most current state because the filesystem may still be actively updating. For accurate and consistent output, it is recommended to unmount the device before running dumpe2fs.

dumpe2fs Command - Quick Cheat Sheet

Taskdumpe2fs Command
Display filesystem superblock informationsudo dumpe2fs /dev/sdXN
Show filesystem details with block group infosudo dumpe2fs -h /dev/sdXN
Display superblock information onlysudo dumpe2fs -h /dev/sdXN
Show filesystem block group informationsudo dumpe2fs /dev/sdXN
Display backup superblockssudo dumpe2fs /dev/sdXN | grep -i superblock
Show filesystem UUIDsudo dumpe2fs /dev/sdXN | grep UUID
Display inode informationsudo dumpe2fs /dev/sdXN | grep -i inode
Show filesystem featuressudo dumpe2fs -h /dev/sdXN | grep -i features
Display block size and filesystem parameterssudo dumpe2fs -h /dev/sdXN
Check filesystem mount informationsudo dumpe2fs -h /dev/sdXN | grep -i mount
Display dumpe2fs versiondumpe2fs -V

This quick reference summarizes the most commonly used dumpe2fs command examples in Linux for inspecting ext2, ext3, and ext4 filesystem metadata and superblock information.


Common dumpe2fs Examples

To display full filesystem metadata:

bash
sudo dumpe2fs /dev/sdc1

This shows superblock details and block group descriptors.

Show Only Superblock Information

To display header-level superblock information only:

bash
sudo dumpe2fs -h /dev/sdc1

This includes filesystem UUID, block size, inode count, and features.

Show Backup Superblocks

To list backup superblock locations:

bash
sudo dumpe2fs /dev/sdc1 | grep Backup

These backup superblocks are useful during filesystem recovery.

Show Bad Blocks

To display blocks marked as bad:

bash
sudo dumpe2fs -b /dev/sdc1

If no output appears, no bad blocks are recorded.

Show UUID and Filesystem Features

To extract only the filesystem UUID:

bash
sudo dumpe2fs -h /dev/sdc1 | grep UUID

To display enabled filesystem features:

bash
sudo dumpe2fs -h /dev/sdc1 | grep features

Show Inode Counts and Block Size Information

To display inode and block statistics:

bash
sudo dumpe2fs -h /dev/sdc1 | grep -E "Inode count|Block count|Block size"

This helps analyze filesystem capacity and structure.

Show Mount Count and Last Mount/Write Times

To check mount count and limits:

bash
sudo dumpe2fs -h /dev/sdc1 | grep -E "Mount count|Maximum mount count"

To check last mount and write times:

bash
sudo dumpe2fs -h /dev/sdc1 | grep -E "Last mount time|Last write time"

Filter Specific Fields Using grep

To filter and extract specific details efficiently:

bash
sudo dumpe2fs -h /dev/sdc1 | grep -i block

This is useful when analyzing large filesystem outputs quickly.


Practical Use Cases

Recover Corrupted Superblock Using Backup Locations

If the primary superblock becomes corrupted, you can use dumpe2fs to identify backup superblock locations:

bash
sudo dumpe2fs /dev/sdX1 | grep Backup

Once you identify a backup superblock (for example, 32768), you can attempt recovery using fsck:

bash
sudo fsck.ext4 -b 32768 /dev/sdX1

This is one of the most common recovery scenarios for ext4 filesystems.

Diagnose Filesystem Errors with dumpe2fs + fsck

If a filesystem fails to mount or shows errors, inspect metadata first:

bash
sudo dumpe2fs -h /dev/sdX1

Check:

  • Filesystem state
  • Error behavior
  • Mount count
  • Last checked time

Then run filesystem check:

bash
sudo fsck.ext4 /dev/sdX1

Using dumpe2fs before fsck helps understand the filesystem condition.

Check Filesystem Health and Statistics

To analyze filesystem capacity and usage:

bash
sudo dumpe2fs -h /dev/sdX1 | grep -E "Block count|Free blocks|Inode count"

This helps you:

  • Estimate space usage
  • Monitor inode exhaustion
  • Validate block size configuration

Use dumpe2fs Output for Tuning and Maintenance

dumpe2fs shows parameters such as:

  • Maximum mount count
  • Check interval
  • Reserved block count
  • Filesystem features

These values can later be adjusted using tune2fs if needed:

bash
sudo tune2fs -l /dev/sdX1

dumpe2fs is primarily for inspection, while tune2fs modifies settings.


Troubleshooting dumpe2fs Errors

Bad Magic Number in Super-Block

Error example:

bash
dumpe2fs: Bad magic number in super-block

Possible causes:

  • Device is not ext2/ext3/ext4
  • Wrong partition specified
  • Corrupted superblock

Verify filesystem type:

bash
sudo blkid /dev/sdX1

If corrupted, use backup superblock recovery as shown earlier.

Device Busy or Permission Denied

If you see:

bash
dumpe2fs: Permission denied

Run with sudo:

bash
sudo dumpe2fs /dev/sdX1

If the device is busy, check if mounted:

bash
mount | grep sdX1

Unmount before running:

bash
sudo umount /dev/sdX1

Not an ext Filesystem

dumpe2fs only supports ext2, ext3, and ext4.

To confirm filesystem type:

bash
lsblk -f

If the partition uses XFS, Btrfs, or another filesystem, use the appropriate tool instead.

Inconsistent Output Due to Mounted Filesystem

Running dumpe2fs on a mounted filesystem may produce outdated or inconsistent metadata.

For accurate inspection:

bash
sudo umount /dev/sdX1
sudo dumpe2fs /dev/sdX1

Unmounting is strongly recommended before deep analysis.

No Superblock Found – Using Alternate Backup

If fsck reports no valid superblock:

bash
fsck.ext4: Superblock invalid

Find backup superblocks:

bash
sudo dumpe2fs /dev/sdX1 | grep Backup

Then retry fsck with one of the listed backup blocks:

bash
sudo fsck.ext4 -b <backup_block_number> /dev/sdX1

This is a common recovery technique for damaged ext filesystems.


dumpe2fs vs Other Filesystem Tools

dumpe2fs vs tune2fs

Featuredumpe2fstune2fs
PurposeDisplay filesystem metadataModify filesystem parameters
Changes filesystem?NoYes
Common UseView superblock, UUID, inode infoChange UUID, mount count, reserved blocks
Safe to run anytime?Yes (read-only)Use with caution
  • Use dumpe2fs to inspect.
  • Use tune2fs to modify.

Example (view parameters):

bash
sudo dumpe2fs -h /dev/sdX1

Example (modify parameters):

bash
sudo tune2fs -c 20 /dev/sdX1

dumpe2fs vs e2fsck

Featuredumpe2fse2fsck
PurposeDisplay filesystem informationCheck and repair filesystem
Repairs errors?NoYes
Recovery usageShows backup superblocksUses backup superblocks to repair
Risk levelSafeShould run on unmounted filesystem
  • dumpe2fs helps identify superblock backups.
  • e2fsck performs the actual repair.

Example recovery flow:

bash
sudo dumpe2fs /dev/sdX1 | grep Backup
sudo fsck.ext4 -b 32768 /dev/sdX1

dumpe2fs vs debugfs

Featuredumpe2fsdebugfs
PurposeDisplay structured metadataLow-level filesystem debugging
User levelStandard sysadmin toolAdvanced troubleshooting tool
RiskRead-onlyCan modify filesystem
Output formatStructured, readableInteractive shell-like interface
  • Use dumpe2fs for general inspection.
  • Use debugfs for deep forensic analysis.

Summary

The dumpe2fs command is a read-only Linux utility used to inspect ext2, ext3, and ext4 filesystem metadata such as superblock details, block group information, UUID, mount count, inode statistics, and backup superblocks.

It plays a critical role in filesystem troubleshooting and recovery, especially when diagnosing superblock corruption or preparing for fsck repairs. Unlike tune2fs or e2fsck, dumpe2fs does not modify the filesystem, making it a safe and reliable inspection tool for system administrators.

Understanding how dumpe2fs integrates with other ext filesystem tools helps ensure proper maintenance, error recovery, and performance tuning in Linux environments.


Further Reading


What's Next

Rohan Timalsina

Rohan Timalsina

is a technical writer and Linux enthusiast who writes practical guides on Linux commands and system administration. He focuses on simplifying complex topics through clear explanations.