Table of Contents
In this tutorial, I will go through 8 dumpe2fs command examples to manage ext2, ext3 and ext4 filesystem in Linux. dumpe2fs is a very popular free and open source tool to check and manage the Linux based filesystems like ext2, ext3 and ext4. It can be used to check the detailed information of filesystems like UUID, magic number, free blocks, number of free inodes, currently set flags and many more. One can even check the information about corrupted filesystems using dumpe2fs utility.
What is Filesystem
It is an underlying data structure in Linux operating system responsible for storing and managing data storage on a disk partition in a specified manner.
Few of the Linux Filesystems
- EXT2 : It is also Known as second extended filesystem in Linux Kernel. It inherited many features from BSD based Systems. It was once a very popular and default filesystem on Linux until it finally got replaced by ext3 filesystem.
- ETX3 : It is an extended version of ext2 filesystem with enhanced Journalling capabilities. It provides better protection of data and ensures the consistency within the filesystem state.
- EXT4 : It is the most commonly used Linux filesystem as of now. It is the scalable extension of ext3 filesystem and can support file and filesystems up to 16 TB in size. It also supports unlimited number of sub-directories as compared to ext3 filesystem which supports only up to 32,000.
Synopsis
dumpe2fs [ -bfhixV ] [ -o superblock=superblock ] [ -o blocksize=blocksize ] device
dumpe2fs Command Examples to Manage EXT2, EXT3 and EXT4 Filesystem in Linux
Also Read: 7 Simple Steps to Install MTR(My Traceroute) on Linux(RHEL/CentOS 7/8)
Example 1: How to Check dumpe2fs Version in Linux
You can check dumpe2fs command version by using dumpe2fs -Version command as shown below. As you can see from below output, current version is 1.42.9
[root@localhost ~]# dumpe2fs -Version dumpe2fs 1.42.9 (28-Dec-2013) Using EXT2FS Library version 1.42.9
-Version : print the version number of dumpe2fs and exit. More on dumpe2fs Man Page.
Example 2: How to Only Display Superblock Information
If you want to display only the superblock information and not any of the block group descriptor detailed information then you need to use -h
option with dumpe2fs
command as shown below. In this example we are checking only the superblock information using dumpe2fs -h /dev/sdc1 command.
[root@localhost ~]# dumpe2fs -h /dev/sdc1 dumpe2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 378a3ec4-3c5f-46b0-b5ca-18385d1ef00f Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 524288 Block count: 2096896 Reserved block count: 104844 Free blocks: 2022001 Free inodes: 524277 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1023
Example 3: How to Force dumpe2fs to display a filesystem in Linux
If you want to forcefully display a filesystem information even if the dumpe2fs does not understand the set filesystem flags then you need to use -f
option with dumpe2fs command as shown below. In this example we are forcefully displaying /dev/sdc1
filesystem information using dumpe2fs -f /dev/sdc1
command as shown below.
[root@localhost ~]# dumpe2fs -f /dev/sdc1 dumpe2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 378a3ec4-3c5f-46b0-b5ca-18385d1ef00f Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Group 0: (Blocks 0-32767) [ITABLE_ZEROED] Checksum 0xf155, unused inodes 8181 Primary superblock at 0, Group descriptors at 1-1 Reserved GDT blocks at 2-1024 Block bitmap at 1025 (+1025), Inode bitmap at 1041 (+1041) Inode table at 1057-1568 (+1057) 23513 free blocks, 8181 free inodes, 2 directories, 8181 unused inodes Free blocks: 9255-32767 Free inodes: 12-8192 Group 1: (Blocks 32768-65535) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0x0235, unused inodes 8192 Backup superblock at 32768, Group descriptors at 32769-32769 Reserved GDT blocks at 32770-33792 Block bitmap at 1026 (bg #0 + 1026), Inode bitmap at 1042 (bg #0 + 1042) Inode table at 1569-2080 (bg #0 + 1569) 31743 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes Free blocks: 33793-65535 Free inodes: 8193-16384 Group 2: (Blocks 65536-98303) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x9917, unused inodes 8192 Block bitmap at 1027 (bg #0 + 1027), Inode bitmap at 1043 (bg #0 + 1043) Inode table at 2081-2592 (bg #0 + 2081) 32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes Free blocks: 65536-98303 Free inodes: 16385-24576
-f : force dumpe2fs to display a filesystem even though it may have some filesystem feature flags which dumpe2fs may not understand. More on dumpe2fs Man Page.
Example 4: How to Display dumpe2fs command output in Hexadecimal
If you want to display output in hexadecimal format then you need to use -x
option with dumpe2fs command. In this example we are displaying the output of /dev/sdc1
partition filesystem information in hexadecimal format using dumpe2fs -x /dev/sdc1
command as shown below.
[root@localhost ~]# dumpe2fs -x /dev/sdc1 dumpe2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Default directory hash: half_md4 Directory Hash Seed: 2e4ecb7d-91af-41ac-b0e1-15e19aa05eef Journal backup: inode blocks Journal features: journal_64bit Journal size: 128M Journal length: 32768 Journal sequence: 0x00000005 Journal start: 0 Group 0: (Blocks 0x00000000-0x00007fff) [ITABLE_ZEROED] Checksum 0xf155, unused inodes 8181 Primary superblock at 0x00000000, Group descriptors at 0x00000001-0x00000001 Reserved GDT blocks at 0x00000002-0x00000400 Block bitmap at 0x00000401 (+1025), Inode bitmap at 0x00000411 (+1041) Inode table at 0x00000421-0x00000620 (+1057) 23513 free blocks, 8181 free inodes, 2 directories, 8181 unused inodes Free blocks: 0x00002427-0x00007fff Free inodes: 0x0000000c-0x00002000 Group 1: (Blocks 0x00008000-0x0000ffff) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0x0235, unused inodes 8192 Backup superblock at 0x00008000, Group descriptors at 0x00008001-0x00008001 Reserved GDT blocks at 0x00008002-0x00008400 Block bitmap at 0x00000402 (bg #0 + 1026), Inode bitmap at 0x00000412 (bg #0 + 1042) Inode table at 0x00000621-0x00000820 (bg #0 + 1569) 31743 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes Free blocks: 0x00008401-0x0000ffff Free inodes: 0x00002001-0x00004000
-x : print the detailed group information block numbers in hexadecimal format. More on dumpe2fs Man Page.
Example 5: How to Get All Backup Superblock Information of a Filesystem
If you want to check all backup superblock information of a filesystem then you need to grep superblock
keyword from dumpe2fs output. In this example we are checking backup superblock information of ext4 filesystem created on /dev/sdc1
partition using dumpe2fs /dev/sdc1 | grep -i superblock
command as shown below.
[root@localhost ~]# dumpe2fs /dev/sdc1 | grep -i superblock dumpe2fs 1.42.9 (28-Dec-2013) Primary superblock at 0, Group descriptors at 1-1 Backup superblock at 32768, Group descriptors at 32769-32769 Backup superblock at 98304, Group descriptors at 98305-98305 Backup superblock at 163840, Group descriptors at 163841-163841 Backup superblock at 229376, Group descriptors at 229377-229377 Backup superblock at 294912, Group descriptors at 294913-294913 Backup superblock at 819200, Group descriptors at 819201-819201 Backup superblock at 884736, Group descriptors at 884737-884737 Backup superblock at 1605632, Group descriptors at 1605633-1605633
Example 6: How to Print Bad blocks in a Filesystem
If you want to print bad superblock in a filesystem then you need to use dumpe2fs -b /dev/sdc1
command as shown below. In this example, there are no bad blocks on /dev/sdc1
partition filesystem hence nothing is visible on the output.
[root@localhost ~]# dumpe2fs -b /dev/sdc1 dumpe2fs 1.42.9 (28-Dec-2013)
-b : print the blocks which are reserved as bad in the filesystem. More on dumpe2fs Man Page.
Example 7: How to Check all the available options of dumpe2fs Command in Linux
If you want to check all the available options of dumpe2fs command then you need to use dumpe2fs -h
command as shown below.
[root@localhost ~]# dumpe2fs -h dumpe2fs 1.42.9 (28-Dec-2013) Usage: dumpe2fs [-bfhixV] [-o superblock=<num>] [-o blocksize=<num>] device
-h : only display the superblock information and not any of the block group descriptor detail information. More on dumpe2fs Man Page.
Example 8: How to Check Man Page of dumpe2fs Command in Linux
To check man page of dumpe2fs utility you need to use man dumpe2fs
command as shown below.
[root@localhost ~]# man dumpe2fs DUMPE2FS(8) System Manager's Manual DUMPE2FS(8) NAME dumpe2fs - dump ext2/ext3/ext4 filesystem information SYNOPSIS dumpe2fs [ -bfhixV ] [ -o superblock=superblock ] [ -o blocksize=blocksize ] device DESCRIPTION dumpe2fs prints the super block and blocks group information for the filesystem present on device. Note: When used with a mounted filesystem, the printed information may be old or inconsistent. OPTIONS -b print the blocks which are reserved as bad in the filesystem. -o superblock=superblock use the block superblock when examining the filesystem. This option is not usually needed except by a filesystem wizard who is examining the remains of a very badly corrupted filesystem. -o blocksize=blocksize use blocks of blocksize bytes when examining the filesystem. This option is not usually needed except by a filesystem wizard who is examining the remains of a very badly corrupted filesystem. -f force dumpe2fs to display a filesystem even though it may have some filesystem feature flags which dumpe2fs may not understand (and which can cause some of dumpe2fs's display to be suspect). -h only display the superblock information and not any of the block group descriptor detail information.
Popular Recommendations:-
How to Install and Use i3 Window Manager on Ubuntu 20.04
Troubleshooting Guide to Fix All Postfix mail Server issues in Linux[Practical Solutions]
How to Suppress all the output of a Linux Bash Shell Script
How to Convert/Change time to epoch time using date utility on Linux/Unix Server
25 Practical and Useful rpm command examples in Linux{cheatsheet}
How to Install jq(JSON Processor) on RHEL/CentOS 7/8
How to Defragment an XFS Filesystem in Linux(5 Simple and Effective Steps)
How to Install Arpwatch tool on RHEL/CentOS 7/8(Simple and Effective Steps)