Wednesday, April 11, 2012

Filesystem SuperBlock


Superblock describes the state of file system, like, how large it is, how many files it can store, where to find free space on the file system, etc.

The  super block consists of the following fields

  • size of the file system
  • number of free blocks in the file system
  • a list of free blocks available on the file system
  • index of the next free block available in the free block list
  • the size of inode list
  • the number of free inodes in the filesystem
  • a list of free inodes in the file system
  • the index of the next free inode in the free inode list
  • lock fields for free blocks and free inode lists
  • a flag indicating that the super block has been modified 

We usually create a filesystem on every partition we make on the hard disk. Linux maintains multiple redundant copies of the superblock in every file system. In emergency situations,the backup copies can be used to restore primary damaged superblock. 

Say, for example, to get the details of superblock for the partition /dev/sda1

# dumpe2fs /dev/sda1 | grep -i superblock
dumpe2fs 1.41.14 (22-Dec-2010)
  Primary superblock at 1, Group descriptors at 2-3
  Backup superblock at 8193, Group descriptors at 8194-8195
  Backup superblock at 24577, Group descriptors at 24578-24579
  Backup superblock at 40961, Group descriptors at 40962-40963
  Backup superblock at 57345, Group descriptors at 57346-57347
  Backup superblock at 73729, Group descriptors at 73730-73731
  Backup superblock at 204801, Group descriptors at 204802-204803
  Backup superblock at 221185, Group descriptors at 221186-221187
  Backup superblock at 401409, Group descriptors at 401410-401411


No comments:

Post a Comment