First, figure out what partition we’re dealing with.
The above will list all the partitions on all the drives in your computer. To recover a lost partition, your going to need Testdisk. Testdisk is included in Parted Magic, and there’s a great guide on their site. For this though, we just need the partition number, such as /dev/sda3 or /dev/hdb1.
Make sure your superblock is the problem, by starting a filesystem check, replacing xxx with your partition name. Here, you can change ext4 to ext3, or ext2 to suit the filesystem.
If your superblock is corrupt, the output will look like this
Find where your superblock backups are kept.
e2fsck 1.41.4 (27-Jan-2009)
.ext4: Group descriptors
bad... trying backup blocks...
.ext4: Bad magic number
The superblock could not be
or does not describe a correct ext4
filesystem. If the device is valid and it really contains an ext4
filesystem (and not swap or ufs or something
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 &
Down at the bottom of this output, should be a list of the backups
mke2fs -n /dev/xxx
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Your almost there. Finally, restore the superblock from the backup, again replacing the x’s with your partition name, and block_number with the first backup superblock.
e2fsck -b block_number /dev/xxx
Now reboot, and your superblock should be fixed. If it’s not, repeat the steps, but restore a different backup superblock