How can I dump the contents of a filesystem's superblock?

6,183

I'm not sure how you can examine any particular superblock, but you can use this command to examine the general contents that all the superblocks share like so, using dumpe2fs.

$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less

Example

$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          xxxxxxx-xxxx-xxxx-xxxx-88c06ecdd872
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
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26722304
Block count:              106857472
Reserved block count:     5342873
Free blocks:              67134450
Free inodes:              25815736
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      998
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sat Dec  7 20:41:58 2013
Last mount time:          Sun Dec 22 21:31:01 2013
...

References

Share:
6,183

Related videos on Youtube

slm
Author by

slm

Worked in the tech field for over 20+ years. Started out learning basic on an Apple IIe then on a TRS-80. Been interested in computer hardware and software my entire life. Consider myself lucky that my hobby as a kid/adult is what I get to do everyday earning a living. You can learn more about me here. ============================================================ Stolen from @Mokubai: First, please put down the chocolate-covered banana and step away from the European currency systems. You may consider how to ask a question.

Updated on September 18, 2022

Comments

  • slm
    slm over 1 year

    I understand that I can list the location of a filesystem's superblocks using the following commands.

    Example

    First get the device handle for the current directory.

    $ df -h .
    Filesystem                         Size  Used Avail Use% Mounted on
    /dev/mapper/fedora_greeneggs-home  402G  146G  236G  39% /home
    

    Then use this command to list the superblocks for handle /dev/mapper/fedora_greeneggs-home.

    $ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | grep -i superblock
    dumpe2fs 1.42.7 (21-Jan-2013)
      Primary superblock at 0, Group descriptors at 1-26
      Backup superblock at 32768, Group descriptors at 32769-32794
      Backup superblock at 98304, Group descriptors at 98305-98330
      Backup superblock at 163840, Group descriptors at 163841-163866
      Backup superblock at 229376, Group descriptors at 229377-229402
      Backup superblock at 294912, Group descriptors at 294913-294938
      Backup superblock at 819200, Group descriptors at 819201-819226
      Backup superblock at 884736, Group descriptors at 884737-884762
      Backup superblock at 1605632, Group descriptors at 1605633-1605658
      Backup superblock at 2654208, Group descriptors at 2654209-2654234
      Backup superblock at 4096000, Group descriptors at 4096001-4096026
      Backup superblock at 7962624, Group descriptors at 7962625-7962650
      Backup superblock at 11239424, Group descriptors at 11239425-11239450
      Backup superblock at 20480000, Group descriptors at 20480001-20480026
      Backup superblock at 23887872, Group descriptors at 23887873-23887898
      Backup superblock at 71663616, Group descriptors at 71663617-71663642
      Backup superblock at 78675968, Group descriptors at 78675969-78675994
      Backup superblock at 102400000, Group descriptors at 102400001-102400026
    

    But how does one actually examine the contents of one of these superblocks?