Using the `dumpe2fs` Command (with examples)

Using the `dumpe2fs` Command (with examples)

The dumpe2fs command is used to print the super block and block group information for ext2, ext3, and ext4 filesystems. It allows users to retrieve detailed information about a specific filesystem, such as reserved bad blocks, feature flags, and group information.

Display ext2, ext3 and ext4 filesystem information

dumpe2fs /dev/sdXN

Motivation: This is the most common use case for the dumpe2fs command. It allows users to obtain general information about the filesystem, such as the number of blocks, block size, inode size, and file system UUID. This information can be useful in determining the overall properties of the filesystem and its capabilities.

Explanation: The command dumpe2fs /dev/sdXN is used to display ext2, ext3, and ext4 filesystem information for the specified device /dev/sdXN. /dev/sdXN represents the block device node for the filesystem to be examined. For example, /dev/sda1 represents the first partition on the first SCSI/SATA/USB drive.

Example Output:

Filesystem volume name:   myVolume
Last mounted on:          /
Filesystem UUID:          c6b9e902-2b5a-4b28-9312-0ddca1eaf497
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
...
Backup superblock at 32768, Group descriptors at 32769-32780
Reserved GDT blocks at 32781-32808
First block after superblock at 32809
...
...

Display the blocks which are reserved as bad in the filesystem

dumpe2fs -b /dev/sdXN

Motivation: This use case allows users to identify any blocks on the filesystem that are reserved as bad. Bad blocks can occur due to physical damage or errors on the storage device, and knowing their location can be important for overall filesystem health and maintenance.

Explanation: The command dumpe2fs -b /dev/sdXN is used to display the blocks that are reserved as bad in the ext2, ext3, or ext4 filesystem on the device /dev/sdXN. The -b option specifically tells dumpe2fs to display the bad block information.

Example Output:

Bad block inode:          256
Bad blocks:               2048-2051,4096-4099,6144,1048576-1048577

Force display filesystem information even with unrecognizable feature flags

dumpe2fs -f /dev/sdXN

Motivation: This use case allows users to force the display of filesystem information even in cases where there are unrecognizable feature flags. In some situations, a filesystem may have feature flags that are not recognized by the dumpe2fs command. By using the -f option, users can still retrieve as much information as possible.

Explanation: The command dumpe2fs -f /dev/sdXN is used to force the display of filesystem information for the specified device /dev/sdXN, even if there are unrecognizable feature flags. The -f option ignores any unrecognized feature flags and attempts to retrieve as much information as possible.

Example Output:

Filesystem features:      has_journal unrecognizable_feature_flag

Only display the superblock information and not any of the block group descriptor detail information

dumpe2fs -h /dev/sdXN

Motivation: This use case is beneficial when the user only needs the basic information about the filesystem, such as the block and inode counts, file system UUID, and mount count. By excluding the block group descriptor detail information, the output can be more concise and easier to read.

Explanation: The command dumpe2fs -h /dev/sdXN is used to display only the superblock information of the ext2, ext3, or ext4 filesystem on the device /dev/sdXN, without including any block group descriptor detail information. The -h option stands for “human-readable” and produces a condensed output.

Example Output:

Filesystem volume name:   myVolume
Last mounted on:          /
Filesystem UUID:          c6b9e902-2b5a-4b28-9312-0ddca1eaf497
Filesystem flags:         signed_directory_hash 
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              65536
Block count:              262144
...
dumpe2fs -x /dev/sdXN

Motivation: This use case is useful for obtaining detailed group information, such as the block bitmap block, inode bitmap block, and inode table block numbers, in hexadecimal format. Hexadecimal format allows for more compact representation of numbers and is commonly used in low-level system operations.

Explanation: The command dumpe2fs -x /dev/sdXN is used to display the detailed group information of the ext2, ext3, or ext4 filesystem on the device /dev/sdXN, including the block numbers in hexadecimal format. The -x option instructs dumpe2fs to display the hexadecimal representation of block numbers.

Example Output:

Block bitmap block:       8
Inode bitmap block:       9
Inode table block:        10-13
...

Related Posts

How to use the command 'cloudphotod' (with examples)

How to use the command 'cloudphotod' (with examples)

The ‘cloudphotod’ command is used to synchronize iCloud Photos. It is not meant to be manually invoked by the user.

Read More
How to use the command 'networkctl' (with examples)

How to use the command 'networkctl' (with examples)

The ’networkctl’ command is a powerful tool that allows users to manage network links and configurations using systemd-networkd.

Read More
Using WebTorrent CLI (with examples)

Using WebTorrent CLI (with examples)

WebTorrent is a command-line tool that allows you to download and stream torrents.

Read More