Sometime things goes wrong and filesystem finish in a corrupted state.
That were tools like fsck
come to the rescue:
fsck /dev/sda5
fsck 1.41.4 (27-Jan-2009)
e2fsck 1.41.4 (27-Jan-2009)
fsck.ext4: Group descriptors look bad... trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sda5
The superblock could not be read 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 else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
Oups. The error “Bad magic number in super-block” clearly indicate that the superblock of the partition /dev/sda5
is in bad shape. But you can use superblock backup to restore the filesystem in a functional state.
First lets find where your superblock backups are kept:
mke2fs -n /dev/xxx
...
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Then restore the superblock from one of its backup:
e2fsck -b 2654208 /dev/sda5