Linux dumpe2fs Command with Practical Examples

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to use the dumpe2fs command in Linux to retrieve detailed information about Ext2, Ext3, or Ext4 filesystems. The dumpe2fs command provides a comprehensive overview of filesystem metadata, including block sizes, inode counts, journal information, and various other statistics. This information can be valuable for troubleshooting, monitoring, and understanding the state of your filesystem. To use the dumpe2fs command, you will need to provide the device name of the filesystem you want to inspect, such as /dev/sda1. The command output includes a wealth of details about the filesystem, which you can analyze to gain a deeper understanding of its configuration and health.

Linux Commands Cheat Sheet


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux(("`Linux`")) -.-> linux/SystemInformationandMonitoringGroup(["`System Information and Monitoring`"]) linux/BasicFileOperationsGroup -.-> linux/ls("`Content Listing`") linux/SystemInformationandMonitoringGroup -.-> linux/df("`Disk Space Reporting`") linux/SystemInformationandMonitoringGroup -.-> linux/du("`File Space Estimating`") linux/SystemInformationandMonitoringGroup -.-> linux/mount("`File System Mounting`") subgraph Lab Skills linux/ls -.-> lab-422654{{"`Linux dumpe2fs Command with Practical Examples`"}} linux/df -.-> lab-422654{{"`Linux dumpe2fs Command with Practical Examples`"}} linux/du -.-> lab-422654{{"`Linux dumpe2fs Command with Practical Examples`"}} linux/mount -.-> lab-422654{{"`Linux dumpe2fs Command with Practical Examples`"}} end

Understand the Purpose and Syntax of dumpe2fs Command

In this step, you will learn about the purpose and syntax of the dumpe2fs command in Linux. The dumpe2fs command is a powerful tool used to retrieve detailed information about an Ext2, Ext3, or Ext4 filesystem.

The dumpe2fs command provides a comprehensive overview of the filesystem metadata, including block sizes, inode counts, journal information, and various other statistics. This information can be valuable for troubleshooting, monitoring, and understanding the state of your filesystem.

To use the dumpe2fs command, you need to provide the device name of the filesystem you want to inspect. For example, to retrieve information about the /dev/sda1 filesystem, you would run the following command:

sudo dumpe2fs /dev/sda1

Example output:

dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   <none>
Filesystem UUID:          a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2621440
Block count:              10485760
Reserved block count:     524288
Free blocks:              9122367
Free inodes:              2621345
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Tue Feb 28 11:28:41 2023
Last mount time:          Tue Feb 28 11:28:41 2023
Last write time:          Tue Feb 28 11:28:41 2023
Mount count:              1
Maximum mount count:      -1
Last checked:             Tue Feb 28 11:28:41 2023
Check interval:           0 (<none>)
Lifetime writes:          8 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
Journal backup:           inode blocks

The output provides a wealth of information about the filesystem, including its volume name, UUID, revision, features, flags, block and inode counts, and various other metadata.

Understanding the purpose and syntax of the dumpe2fs command is an essential skill for system administrators and Linux enthusiasts who need to manage and maintain their file systems effectively.

Retrieve Detailed Information About an Ext2/Ext3/Ext4 Filesystem

In this step, you will learn how to use the dumpe2fs command to retrieve detailed information about an Ext2, Ext3, or Ext4 filesystem.

First, let's identify the filesystem you want to inspect. You can use the df command to list the mounted filesystems on your system:

labex@ubuntu:~/project$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       9.8G  1.3G  8.0G  14% /
tmpfs           1.6G     0  1.6G   0% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
tmpfs           1.6G     0  1.6G   0% /run/user/1000

In this example, the root filesystem is located on /dev/sda1, so we will use that as the target for the dumpe2fs command.

To retrieve detailed information about the Ext filesystem, run the following command:

sudo dumpe2fs /dev/sda1

This will output a comprehensive report about the filesystem, including details about block sizes, inode counts, journal information, and various other statistics.

Example output:

dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   <none>
Filesystem UUID:          a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2621440
Block count:              10485760
Reserved block count:     524288
Free blocks:              9122367
Free inodes:              2621345
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Tue Feb 28 11:28:41 2023
Last mount time:          Tue Feb 28 11:28:41 2023
Last write time:          Tue Feb 28 11:28:41 2023
Mount count:              1
Maximum mount count:      -1
Last checked:             Tue Feb 28 11:28:41 2023
Check interval:           0 (<none>)
Lifetime writes:          8 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
Journal backup:           inode blocks

The output provides a wealth of information about the filesystem, including its volume name, UUID, revision, features, flags, block and inode counts, and various other metadata.

Understanding how to interpret the dumpe2fs output is crucial for managing and troubleshooting Ext-based filesystems.

Analyze Filesystem Metadata and Statistics Using dumpe2fs

In this step, you will learn how to analyze the filesystem metadata and statistics provided by the dumpe2fs command.

The dumpe2fs output contains a wealth of information about the filesystem, including:

  • Filesystem volume name and UUID
  • Filesystem revision and features
  • Block and inode counts
  • Free space and reserved blocks
  • Filesystem creation and last mount/write times
  • Journal information
  • And much more

Let's take a closer look at some of the key information in the dumpe2fs output:

Filesystem volume name:   <none>
Filesystem UUID:          a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum

The volume name, UUID, and filesystem revision provide basic identification information about the filesystem. The "Filesystem features" section lists the advanced features enabled on the filesystem, which can be important for understanding its capabilities and potential limitations.

Inode count:              2621440
Block count:              10485760
Reserved block count:     524288
Free blocks:              9122367
Free inodes:              2621345

The block and inode counts, along with the free space information, give you a clear picture of the filesystem's capacity and utilization.

Filesystem created:       Tue Feb 28 11:28:41 2023
Last mount time:          Tue Feb 28 11:28:41 2023
Last write time:          Tue Feb 28 11:28:41 2023
Mount count:              1
Maximum mount count:      -1

The timestamps and mount count data can be useful for understanding the filesystem's history and activity.

By analyzing the various metadata and statistics provided by the dumpe2fs command, you can gain a deeper understanding of the state and health of your Ext-based filesystem.

Summary

In this lab, you learned about the purpose and syntax of the dumpe2fs command in Linux, which is used to retrieve detailed information about an Ext2, Ext3, or Ext4 filesystem. The dumpe2fs command provides a comprehensive overview of the filesystem metadata, including block sizes, inode counts, journal information, and various other statistics. This information can be valuable for troubleshooting, monitoring, and understanding the state of your filesystem. You also learned how to use the dumpe2fs command to inspect the /dev/sda1 filesystem and interpret the output.

Linux Commands Cheat Sheet

Other Linux Tutorials you may like