LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > kostya
User Name
Password

Notices

Rate this Entry

fixing superblock problems

Posted 07-31-2011 at 10:49 AM by kostya

The purpose of this blog is just to sum up various solutions I found which help in fixing a partition superblock related problems. I just thought, instead of googling every time such thing happens, why not keep it all in one document?

The problem started when after resizing my 1st ext4 partition I got problems mounting the resized partition and fsck would give off this error:
Code:
sudo fsck.ext4 -v /dev/sda1
e2fsck 1.41.14 (22-Dec-2010)
The filesystem size (according to the superblock) is 19531245 blocks
The physical size of the device is 19518208 blocks
Either the superblock or the partition table is likely to be corrupt!
The first solution was found HERE and its idea is in fixing the bad superblock by restoring it from backup. It runs as follows:
Code:
$sudo mke2fs -n /dev/sda1

Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4882432 inodes, 19518208 blocks
975910 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
596 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424
So the line which I made in BOLD is where I get the superblock backups for the given partition. So I'm supposed next to just restore the superblock from one of these backups. For example:
Code:
sudo e2fsck -b 11239424 /dev/sda1
This fixes various superblock related problems, but it didn't fix mine !...

Then, however, I found one thread answering this question quite some time ago. The option given there is just to resize the partition back to the size "physical size of the device" as reported by fsck.ext4 using the 'resize2fs tool:
Code:
sudo resize2fs /dev/sda1 19518208
...
resize2fs 1.41.14 (22-Dec-2010)
Resizing the filesystem on /dev/sda1 to 19518208 (4k) blocks.
The filesystem on /dev/sda1 is now 19518208 blocks long.
Obviously this operation writes the physical size of the partition back to the superblock and voila! The partition is back and mountable with all the files accessible again!
Posted in Uncategorized
Views 4823 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 12:16 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration