dumpe2fs command in Linux [Cheat Sheet]

Introduction to dumpe2fs command

The dumpe2fs is a part of the e2fsprogs package. The dumpe2fs command displays the superblock and block group information of the Linux filesystem. It works with the ext2/ext3/ext4 filesystem present on the device.

 

Syntax to use dumpe2fs command

The syntax for using the dumpe2fs command is as follows:

Advertisement
$ sudo dumpe2fs [option] device

 

Different examples to use dumpe2fs command

1. Print super block and block group information

The dumpe2fs command without any options displays information of superblock and block groups. You have to specify the device where the filesystem is present.

$ sudo dumpe2fs device

Sample Output:

golinux@ubuntu-PC:~$ sudo dumpe2fs /dev/sdc1
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          e349264e-6ae6-4326-89ce-511dd8537e7e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash 
...
Group 0: (Blocks 0-32767)
  Primary superblock at 0, Group descriptors at 1-1
  Reserved GDT blocks at 2-298
  Block bitmap at 299 (+299)
  Inode bitmap at 300 (+300)
  Inode table at 301-802 (+301)
  31959 free blocks, 8021 free inodes, 2 directories
  Free blocks: 809-32767
  Free inodes: 12-8032
Group 1: (Blocks 32768-65535)
  Backup superblock at 32768, Group descriptors at 32769-32769
  Reserved GDT blocks at 32770-33066
  Block bitmap at 33067 (+299)
  Inode bitmap at 33068 (+300)
  Inode table at 33069-33570 (+301)
  31965 free blocks, 8032 free inodes, 0 directories
  Free blocks: 33571-65535
  Free inodes: 8033-16064
...
NOTE:

When dumpe2fs command is used with a mounted filesystem, the output information may be old or inconsistent. So you can unmount the device and execute this command.

 

2. Print the superblock information only

A superblock is a record of the filesystem's properties, such as its size, block size, inode tables location and size, empty and filled blocks, and block group size.

You can use the -h option to view only the superblock information for the filesystem.

$ sudo dumpe2fs -h /dev/sdc1

Sample Output:

dumpe2fs command to display superblock information only

 

Advertisement

3. Force display a filesystem

The -f option is used to force dumpe2fs to display a filesystem even if there are some filesystem feature flags that dumpe2fs do not understand.

$ sudo dumpe2fs -f /dev/sdc1

Sample Output:

golinux@ubuntu-PC:~$ sudo dumpe2fs -f /dev/sdc1
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          e349264e-6ae6-4326-89ce-511dd8537e7e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
...
Group 0: (Blocks 0-32767)
  Primary superblock at 0, Group descriptors at 1-1
  Reserved GDT blocks at 2-298
  Block bitmap at 299 (+299)
  Inode bitmap at 300 (+300)
  Inode table at 301-802 (+301)
  31959 free blocks, 8021 free inodes, 2 directories
  Free blocks: 809-32767
  Free inodes: 12-8032
Group 1: (Blocks 32768-65535)
  Backup superblock at 32768, Group descriptors at 32769-32769
  Reserved GDT blocks at 32770-33066
  Block bitmap at 33067 (+299)
  Inode bitmap at 33068 (+300)
  Inode table at 33069-33570 (+301)
  31965 free blocks, 8032 free inodes, 0 directories
  Free blocks: 33571-65535
  Free inodes: 8033-16064
...

 

4. Print information in hexadecimal format

The -x option displays the detailed group information block numbers in hexadecimal format.

$ sudo dumpe2fs -x /dev/sdc1

Sample Output:

golinux@ubuntu-PC:~$ sudo dumpe2fs -x /dev/sdc1
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          e349264e-6ae6-4326-89ce-511dd8537e7e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash 
...
Group 0: (Blocks 0x0000-0x7fff)
  Primary superblock at 0x0000, Group descriptors at 0x0001-0x0001
  Reserved GDT blocks at 0x0002-0x012a
  Block bitmap at 0x012b (+299)
  Inode bitmap at 0x012c (+300)
  Inode table at 0x012d-0x0322 (+301)
  31959 free blocks, 8021 free inodes, 2 directories
  Free blocks: 0x0329-0x7fff
  Free inodes: 0x000c-0x1f60
Group 1: (Blocks 0x8000-0xffff)
  Backup superblock at 0x8000, Group descriptors at 0x8001-0x8001
  Reserved GDT blocks at 0x8002-0x812a
  Block bitmap at 0x812b (+299)
  Inode bitmap at 0x812c (+300)
  Inode table at 0x812d-0x8322 (+301)
  31965 free blocks, 8032 free inodes, 0 directories
  Free blocks: 0x8323-0xffff
  Free inodes: 0x1f61-0x3ec0
...

 

5. Display bad blocks in filesystem

Bad blocks are parts of a storage device that are completely damaged and are no longer reliable for storing data. You can use -b option view the blocks that are reserved as bad in the filesystem.

$ sudo dumpe2fs -b /dev/sdc1

Sample Output:

Advertisement
golinux@ubuntu-PC:~$ sudo dumpe2fs -b /dev/sdc1
dumpe2fs 1.45.5 (07-Jan-2020)

As you can see, no information is displayed on the output. It means there are no bad blocks on the specified device.

 

6. View all backup superblocks

The following example prints all backup superblocks with group descriptors of a filesystem.

$ sudo dumpe2fs /dev/sdc1 | grep Backup

Sample Output:

dumpe2fs command to display backup superblock information

 

7. Display the version of dumpe2fs

The -V option returns the version number of dumpe2fs and exit.

$ dumpe2fs -V

Sample Output:

golinux@ubuntu-PC:~$ dumpe2fs -V
dumpe2fs 1.45.5 (07-Jan-2020)
	Using EXT2FS Library version 1.45.5

 

Conclusion

dumpe2fs is a command-line tool to get useful information on superblock and block groups of the filesystem. You have learned how to use dumpe2fs command with different available options. If you have any questions, let us know in the comment section.

 

Advertisement

What’s Next

15 tune2fs command examples in Linux [Cheat Sheet]
How to create filesystem on a Linux partition or logical volume

 

Further Reading

man page for dumpe2fs command

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment

X