0

I have an external HD which is divided into two partitions: an exFAT with 700GB and a LUKS partition with 300GB. I was copying from my computer to the luks partition but it got slow and stucked so I decided to remove the usb connection. Now the LUKS partition doesn't mount and it is filled with important files :( How can I fix this? Here are two outputs:

$ sudo parted -l

Model: ********** (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size   Type     File system  Sinalizador
 1      1049kB  300GB   300GB  primary
 2      300GB   1000GB  700GB  primary

$ sudo fsck /dev/sdb

fsck from util-linux 2.28.2
e2fsck 1.43.3 (04-Sep-2016)
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/sdb

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/sdb

Please help!

Edit

I followed this tutorial and tried to restore to a superblock backup. Using this I find all the backups:

$ sudo mke2fs -n /dev/sdb

mke2fs 1.43.3 (04-Sep-2016)
Found a dos partition table in /dev/sdb
Proceed anyway? (y,n) y
Creating filesystem with 244189952 4k blocks and 61054976 inodes
Filesystem UUID: ***************************
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848

I tried to restore to every single one of the block numbers listed but it always prompted me with the same error, for example:

$ sudo e2fsck -b 32768 /dev/sdb

e2fsck 1.43.3 (04-Sep-2016)
e2fsck: Bad magic number in super-block while trying to open /dev/sdb

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/sdb
  • When your system failed to mount the LUKS partition, what partition name did it mention in the error message? /dev/mapper/something? – Mark Plotnick Jul 14 '17 at 16:15
  • did you try what the error message says (trying alternative super blocks, which also may be in other places, find out with "dumpe2fs /dev/sdb1| grep -i superblock")? – Jaleks Jul 14 '17 at 16:28
  • @MarkPlotnick It's strange, now it apparently mounts and nautilus shows me the folders I have inside the partition, but when I go inside one of them it takes forever to show what's inside, and it doesn't show them. – Bella Jul 14 '17 at 17:06
  • @Jaleks I didn't try it, I don't know what it means to be honest... – Bella Jul 14 '17 at 17:08
  • @Jaleks Your command: dumpe2fs 1.43.3 (04-Sep-2016) \newline dumpe2fs: Bad magic number in super-block while trying to open /dev/sdb1 \newline Couldn't find valid filesystem superblock. – Bella Jul 14 '17 at 17:23
0

Alright, check if your LUKS header is intact:

cryptsetup luksDump /dev/sdb2

If you get an error, I'm sorry but unless you have a backup of your LUKS header, your important files cannot be recovered.

If you happen to have a backup of the LUKS header you can restore it:

cryptsetup luksHeaderRestore /dev/sdb2 --header-backup-file somefile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.