{"id":1843,"date":"2012-03-31T11:21:20","date_gmt":"2012-03-31T15:21:20","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1843"},"modified":"2013-03-20T08:38:23","modified_gmt":"2013-03-20T12:38:23","slug":"howto-recover-a-linux-partition-after-a-superblock-corruption","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/howto-recover-a-linux-partition-after-a-superblock-corruption","title":{"rendered":"Howto Recover a Linux Partition after a Superblock corruption?"},"content":{"rendered":"<p><strong>A SuperBlock in Linux saves information about the File System<\/strong> like, the File System type, size, status etc. A File system cannot be mounted if a Superblock is corrupted.\u00a0 Corruption of superblock can occur due to various reasons like, abnormal shutdown due to power failure, virus infection, file system corruption etc.<\/p>\n<p><strong>When a Superblock is corrupted, you receive a &#8221; can\u2019t read superblock&#8221; error message<\/strong> while accessing the File System. For example, if you try to access a Linux ext3 partition say, \/dev\/sda3, you will receive the following message:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">\/dev\/sda3: Input\/output error<\/span>\r\n<span style=\"color: #0000ff;\">mount: \/dev\/sda3: can\u2019t read superblock<\/span><\/pre>\n<\/blockquote>\n<p><strong>Linux ext3 file system automatically maintains a backup of superblock at various locations.<\/strong> In cases such as these, you have to restore a superblock from an alternate\u00a0 backup location to retrieve the data.<\/p>\n<p><span style=\"text-decoration: underline;\"><span style=\"color: #0000ff;\"><strong>Note:<\/strong><\/span><\/span> You should unmount the partition before performing this task.<\/p>\n<p>First, <strong>find \/ list the superblock locations of the file system<\/strong> \/dev\/sda3 (we are using sda3 as an example, your partition may be different)<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># dumpe2fs \/dev\/sda3 | grep superblock<\/span>\r\n dumpe2fs 1.39 (29-May-2006)\r\n Primary superblock at 1, Group descriptors at 2-2\r\n Backup superblock at 8193, Group descriptors at 8194-8194\r\n Backup superblock at 24577, Group descriptors at 24578-24578\r\n Backup superblock at 40961, Group descriptors at 40962-40962\r\n Backup superblock at 57345, Group descriptors at 57346-57346\r\n Backup superblock at 73729, Group descriptors at 73730-73730<\/pre>\n<\/blockquote>\n<p>Now, <strong>check and repair (fsck) the file system with an alternate superblock<\/strong> #24577. BTW, try superblock from another location if one doesn&#8217;t work.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># fsck -b 24577 \/dev\/sda3<\/span>\r\n fsck 1.39 (29-May-2006)\r\n e2fsck 1.39 (29-May-2006)\r\n \/dev\/sda3 was not cleanly unmounted, check forced.\r\n Pass 1: Checking inodes, blocks, and sizes\r\n Pass 2: Checking directory structure\r\n Pass 3: Checking directory connectivity\r\n Pass 4: Checking reference counts\r\n Pass 5: Checking group summary information\r\n Free blocks count wrong for group #0 (3553, counted=513).\r\n Fix&lt;y&gt;? yes<\/pre>\n<pre>Free blocks count wrong for group #1 (7681, counted=5059).\r\n Fix&lt;y&gt;? yes<\/pre>\n<pre>Free blocks count wrong for group #19 (7939, counted=7697).\r\n Fix&lt;y&gt;? yes<\/pre>\n<pre>\/boot: ***** FILE SYSTEM WAS MODIFIED *****\r\n \/boot: 35\/50200 files (8.6% non-contiguous), 17906\/200780 blocks<\/pre>\n<\/blockquote>\n<p>Now, <strong>mount the partition<\/strong> once the file system check is over:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># mount \/dev\/sda3 \/mnt<\/span><\/pre>\n<\/blockquote>\n<p>Once the partition is mounted, you can <strong>retrieve the files<\/strong> from \/mnt:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># mkdir backup<\/span>\r\n<span style=\"color: #0000ff;\"># cd \/mnt<\/span>\r\n<span style=\"color: #0000ff;\"># cp filename \/backup\/<\/span><\/pre>\n<\/blockquote>\n<p>BTW, it is always good to keep a backup of your data instead of finding yourself in such situations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A SuperBlock in Linux saves information about the File System like, the File System type, size, status etc. A File system cannot be mounted if a Superblock is corrupted.\u00a0 Corruption of superblock can occur due to various reasons like, abnormal shutdown due to power failure, virus infection, file system corruption etc.<br \/>\nWhen a Superblock is corrupted, you receive a &#8221; can\u2019t read superblock&#8221; error message while accessing the File System. For example, if you try to access a Linux ext3 partition say, \/dev\/sda3, you will receive the following message:<\/p>\n<p>\/dev\/sda3: [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1377,1381,1379,1376,1380,1382,1402,1378],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1843"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=1843"}],"version-history":[{"count":21,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1843\/revisions"}],"predecessor-version":[{"id":1911,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1843\/revisions\/1911"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}