Understanding about superblock and how to recover it from a corrupted partition.

Understanding about superblock and how to recover it from a corrupted partition.

what is superblock?

Superblock is the metadata of the file system, it stores following information

  • Blocks
  • Number of free blocks
  • Inodes per block group
  • Blocks per block group
  • Number of times the file system was mounted since last fsck.
  • Mount time
  • UUID of the file system
  • Write time
  • File System State
  • The file system type
  • The operating system in which the file system was formatted

In linux it usually maintains multiple superblock copies for better redundancy to avoid data loss. From this superblock we can recover data without any loss. Below output will show how to check superblock in a partition, using this superblock we can recover.

root@linux:~# dumpe2fs  /dev/sda2 | grep superblock

  • dumpe2fs 1.42.9 (4-Feb-2014)
  •   Primary superblock at 0, Group descriptors at 1-58
  •   Backup superblock at 32768, Group descriptors at 32769-32826
  •   Backup superblock at 98304, Group descriptors at 98305-98362
  •   Backup superblock at 163840, Group descriptors at 163841-163898
  •   Backup superblock at 229376, Group descriptors at 229377-229434
  •   Backup superblock at 294912, Group descriptors at 294913-294970
  •   Backup superblock at 819200, Group descriptors at 819201-819258
  •   Backup superblock at 884736, Group descriptors at 884737-884794
  •   Backup superblock at 1605632, Group descriptors at 1605633-1605690
  •   Backup superblock at 2654208, Group descriptors at 2654209-2654266

  Here below command will recover the corrupted partition using superblock.

# fsck -b 32768 /dev/sda2

After that mount the partition and create a file.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s