Struggling to repair bad superblock after power outage

Dondochaka

Member
Feb 22, 2021
8
0
6
39
I had a power outage the other day, and now when I boot one of my VMs, I get file system errors.

1663709767585.png

Unfortunately, fsck from the host doesn't work, it complains about an invalid superblock:

Bash:
root@pve:~# fsck /dev/mapper/pve-vm--101--disk--0
fsck from util-linux 2.36.1
e2fsck 1.46.2 (28-Feb-2021)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/mapper/pve-vm--101--disk--0

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/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>
 or
    e2fsck -b 32768 <device>

Found a dos partition table in /dev/mapper/pve-vm--101--disk--0

According to this guide, mke2fs can be used to identify superblock backups:

Bash:
root@pve:~# mke2fs -n /dev/mapper/pve-vm--101--disk--0
mke2fs 1.46.2 (28-Feb-2021)
Found a dos partition table in /dev/mapper/pve-vm--101--disk--0
Proceed anyway? (y,N) y
Creating filesystem with 16777216 4k blocks and 4194304 inodes
Filesystem UUID: 643006fd-c0e9-4589-b9d4-6a66cbce630e
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Unfortunately, the suggested backup of 32768 does not work:

Bash:
root@pve:~# e2fsck -b 32768 /dev/mapper/pve-vm--101--disk--0
e2fsck 1.46.2 (28-Feb-2021)
e2fsck: Bad magic number in super-block while trying to open /dev/mapper/pve-vm--101--disk--0

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/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>
 or
    e2fsck -b 32768 <device>

Found a dos partition table in /dev/mapper/pve-vm--101--disk--0

I'm pretty stuck here, is there anything else I should try?
 
The virtual disk probably contains a partition table (MBR or GPT) and not just the filesystem you want to repair. You'll need to compensate for the additional offset from the start of the virtual disk using a loop device, for example. Or boot the VM from a GParted Live ISO or any other "Linux repair CD" and run the fsck from there.
 
Edit: Actually, ignore the below. Somehow, running fsck a second time worked... thanks again!

Thanks, I finally got around to trying this. I booted to a GParted Live CD and ran fsck, but unfortunately it fails without much further information.
Is there anything else I can try to fix this?

1664060199757.png

Unfortunately I think my backups contain this filesystem error too.
 
Last edited: