missing superblock on encrypted filesystem

4k Views Asked by At

I have a hard drive with ubuntu 14 installed. The whole disk is encrypted. My default users home directory is encrypted as well. Lately, after a system crash, I am presented with a busybox (initramfs) on startup. When I chose to start in recovery mode, I can grasp several error messages like " ... Failed to read block at offset xyz ...".

I searched and found this Q&A: Boot drops to a (initramfs) prompts/busybox

I booted from a CD and followed the instructions. However I am only able to do ...

sudo dumpe2fs /dev/sda1

... and then continue to check and repair superblocks on /dev/sda1 .

If I try ...

sudo dumpe2fs /dev/sda2

... i get the following error message:

dumpe2fs: Attempted to read block from filesystem resulted
in short read while trying to open /dev/sda2
Couldn't find valid filesystem superblock.

gparted shows the partitioning and file systems of the drive as follows:

partition    file system    size    used    unused    flags
-------------------------------------------------------------
/dev/sda1    ext2           243M    210M    32M       boot
/dev/sda2    extended       465G    -       -         -
  /dev/sda5!!crypt-luks     465G    -       -         -
unallocated  unallocated      1M    -       -         -

The warning (!!) at sda5 says "Linux Unified Key Setup encryption is not yet supported".

If I try ...

sudo dumpe2fs /dev/sda5

... it returns this error message:

dumpe2fs: Bad magic number in super-block while trying to open /dev/sda5
Couldn't find valid filesystem superblock.

Mounting and rw-accessing sda1 works without error.

Any clues what is the cause and how i can repair, mount and decrypt the filesystem to boot normaly or at least to recover the data?

2

There are 2 best solutions below

0
On

The given solution has missed some commands that you need to decrypt the file system and access it. Here's the full solution

  1. Boot from Ubuntu USB

  2. cryptsetup luksOpen /dev/rawdevice somename
    
  3. sck /dev/mapper/somename
    

Get backup superblock:

  1. sudo dumpe2fs /dev/mapper/ubuntu--vg-root | grep superblock
    

Fix:

  1. sudo fsck -b 32768 /dev/mapper/ubuntu--vg-root -y
    

Verify:

  1. mkdir /a
    
  2. sudo mount /dev/mapper/ubuntu--vg-root /a
    
0
On

This worked for me:

  1. Boot from Ubuntu USB
  2. get backup superblock:

    sudo dumpe2fs /dev/mapper/ubuntu--vg-root | grep superblock

  3. fix:

    sudo fsck -b 32768 /dev/mapper/ubuntu--vg-root -y

  4. verify

    mkdir /a

    sudo mount /dev/mapper/ubuntu--vg-root /a

I used following links as source:

https://askubuntu.com/questions/137655/boot-drops-to-a-initramfs-prompts-busybox https://serverfault.com/questions/375090/using-fsck-to-check-and-repair-luks-encrypted-disk