DUMPE2FS COMMAND

 

Syntax

dumpe2fs [ -bfhixV ] [ -ob superblock ] [ -oB blocksize ] device

Syntax

dumpe2fs [ -bfhixV ] [ -ob superblock ] [ -oB blocksize ] device
Available option details

-b — print the blocks which are reserved as bad in the filesystem.

-ob superblock — use the block superblock when examining the filesystem. This option is not usually needed except by a filesystem wizard who is examining he remains of a very badly corrupted filesystem.

-oB 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.

-i — display the filesystem data from an image file created by e2image, using device as the pathname to the image file.

-x — print the detailed group information block numbers in hexadecimal format

-V — print the version number of dumpe2fs and exit.

dumpe2fs Examples

dumpe2fs /dev/sda1

Sample Output

dumpe2fs 1.40.2 (12-Jul-2007)
Filesystem volume name:
Last mounted on:
Filesystem UUID: ec7a16c5-c680-45ac-9f1b-856ab960d759
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags: signed directory hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 997472
Block count: 1994060
Reserved block count: 99703
Free blocks: 722777
Free inodes: 807799
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 486
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16352
Inode blocks per group: 511
Filesystem created: Thu Oct 25 18:29:45 2007
Last mount time: Thu Mar 6 13:02:32 2008
Last write time: Thu Mar 6 13:02:32 2008
Mount count: 4
Maximum mount count: 34
Last checked: Thu Feb 14 15:10:27 2008
Check interval: 15552000 (6 months)
Next check after: Tue Aug 12 16:10:27 2008
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
First orphan inode: 50414
Default directory hash: tea
Directory Hash Seed: 836ca201-5370-43e7-a6ce-1606f2a7cd37
Journal backup: inode blocks

Recover partition using alternate superblock

Find out superblock location for /dev/sda2:
# dumpe2fs /dev/sda2 | grep superblock
Sample output:

  Primary superblock at 0, Group descriptors at 1-6
  Backup superblock at 32768, Group descriptors at 32769-32774
  Backup superblock at 98304, Group descriptors at 98305-98310
  Backup superblock at 163840, Group descriptors at 163841-163846
  Backup superblock at 229376, Group descriptors at 229377-229382
  Backup superblock at 294912, Group descriptors at 294913-294918
  Backup superblock at 819200, Group descriptors at 819201-819206
  Backup superblock at 884736, Group descriptors at 884737-884742
  Backup superblock at 1605632, Group descriptors at 1605633-1605638
  Backup superblock at 2654208, Group descriptors at 2654209-2654214
  Backup superblock at 4096000, Group descriptors at 4096001-4096006
  Backup superblock at 7962624, Group descriptors at 7962625-7962630
  Backup superblock at 11239424, Group descriptors at 11239425-11239430
  Backup superblock at 20480000, Group descriptors at 20480001-20480006
  Backup superblock at 23887872, Group descriptors at 23887873-23887878

Now check and repair a Linux file system using alternate superblock # 32768:
# fsck -b 32768 /dev/sda2
Sample output:

fsck 1.40.2 (12-Jul-2007)
e2fsck 1.40.2 (12-Jul-2007)
/dev/sda2 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #241 (32254, counted=32253).
Fix? yes
Free blocks count wrong for group #362 (32254, counted=32248).
Fix? yes
Free blocks count wrong for group #368 (32254, counted=27774).
Fix? yes
..........
/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks

Now try to mount file system using mount command:
# mount /dev/sda2 /mnt
You can also use superblock stored at 32768 to mount partition, enter:
# mount sb={alternative-superblock} /dev/device /mnt
# mount sb=32768 /dev/sda2 /mnt

Try to browse and access file system:
# cd /mnt
# mkdir test
# ls -l
# cp file /path/to/safe/location

assyrian technical blog