Markus Feldmann | 26 Nov 2011 15:15
Picon
Picon

damaged encrypted LUKS device

Hi people,

i had created encrypted device with cryptsetup/LUKS which i setup with 
an ext4 filesystem. This device is an external USB harddisk. When i 
plugin this device it will be automatically mounted by my gnome3 system 
(Debian Wheezey/Testing), but this week i got an error. I did ask the 
ask the LUKS developers what is the problem and they told me that this 
is an ext4 problem.

The error message from gnome is:
> Einhängen von AIRY_1TB nicht möglich
>
> Error mounting: mount: wrong fs type, bad option, bad superblock on /dev/mapper/udisks-luks-uuid-70a2aedf-ce7e-4e12-8f0b-ec7974ebdbd4-uid1000,
> missing codepage or helper program, or other error
> In some cases useful info is found in syslog - try
> dmesg | tail or so

And from <dmesg> i got the message:
> [ 3094.394043] EXT4-fs (dm-0): ext4_check_descriptors: Inode bitmap for group 3328 not in group (block 1235654634)!
> [ 3094.394056] EXT4-fs (dm-0): group descriptors corrupted!

Further on, when i try to <fsck -N /dev/sdb> i get:
> fsck from util-linux 2.19.1
> fsck: fsck.crypto_LUKS: not found
> fsck: Error 2 while executing fsck.crypto_LUKS for /dev/sdb

But cryptsetup is installed, only lvm2 is missing, but i dont have a LVM 
device and as i researched at "debian.org" there is no package which 
provides the command <fsck.crypto_LUKS>.

(Continue reading)

Matija Nalis | 26 Nov 2011 17:40
Picon

Re: damaged encrypted LUKS device


On Sat, Nov 26, 2011 at 03:15:42PM +0100, Markus Feldmann wrote:
> And from <dmesg> i got the message:
> >[ 3094.394043] EXT4-fs (dm-0): ext4_check_descriptors: Inode bitmap for group 3328 not in group
(block 1235654634)!
> >[ 3094.394056] EXT4-fs (dm-0): group descriptors corrupted!
> 
> Further on, when i try to <fsck -N /dev/sdb> i get:
> >fsck from util-linux 2.19.1
> >fsck: fsck.crypto_LUKS: not found
> >fsck: Error 2 while executing fsck.crypto_LUKS for /dev/sdb
> 
> But cryptsetup is installed, only lvm2 is missing, but i dont have a
> LVM device and as i researched at "debian.org" there is no package
> which provides the command <fsck.crypto_LUKS>.
> 
> Any hints/instructions for me?

try "e2fsck -C0 /dev/dm-0" (assuming /dev/dm-0 is your block device 
after decryption).

And do full block-by-block backup of your external USB disk first! 
(using dd(1))

--

-- 
Opinions above are GNU-copylefted.
Markus Peuhkuri | 28 Nov 2011 11:17
Picon
Picon
Favicon

Re: damaged encrypted LUKS device

On 26.11.2011 18:40, Matija Nalis wrote:
> And do full block-by-block backup of your external USB disk first! 
> (using dd(1)) 
And if it happens to abort on error, try http://safecopy.sourceforge.net 
(available on package in recent distros) that makes quite good work on 
reading disks with read errors.  Worked better than any 
dd{_recover,rescue}.  After doing the 3-stage copy, I was able copy 
files from ext4 partition inside LVM that was in qcow2 virtual machine 
image that was on ext3 partition on LVM on the failed disk.

t. Markus
Markus Feldmann | 28 Nov 2011 15:42
Picon
Picon

Re: damaged encrypted LUKS device

Am 26.11.2011 17:40, schrieb Matija Nalis:
>
> try "e2fsck -C0 /dev/dm-0" (assuming /dev/dm-0 is your block device
> after decryption).

How can i be sure, that my cryptsetup/LUKS harddisk is still decrypted?

<cryptsetup status /dev/dm-1> gives me:
> root <at> feld-bert:/home/markus# cryptsetup status /dev/dm-1
> /dev/mapper//dev/dm-1 is active.
>   type:    LUKS1
>   cipher:  aes-xts-plain
>   keysize: 256 bits
>   device:  /dev/sdb
>   offset:  4096 sectors
>   size:    1953521072 sectors
>   mode:    read/write
Bodo Thiesen | 28 Nov 2011 16:58
Picon
Picon

Re: damaged encrypted LUKS device

Hello Markus.

* Markus Feldmann <feldmann_markus <at> gmx.de> hat geschrieben:
>* Am 26.11.2011 17:40, schrieb Matija Nalis:
>> try "e2fsck -C0 /dev/dm-0" (assuming /dev/dm-0 is your block device
>> after decryption).
> How can i be sure, that my cryptsetup/LUKS harddisk is still decrypted?
> <cryptsetup status /dev/dm-1> gives me:
>> root <at> feld-bert:/home/markus# cryptsetup status /dev/dm-1
>> /dev/mapper//dev/dm-1 is active.

That line tells you ;)

So, try a e2fsck -n -C0 /dev/dm-1 (the -n causes no changes to be made
to the file system - errors will be reported only). If it's not too much,
but you're unsure what to do, maybe you want to post them here (use
command

	LANG=C e2fsck -n /dev/dm-1 > some-file.txt

for that and post the contents of some-file.txt). If it's too much maybe
you want to pastebin them and post the link here. In both cases, remember
to strip path names and similar data unless you don't care to publish them.
(However - why are you encrypting them then in the first place?)

Additionally, I suggest following Markus Peuhkuri's tip to first create a
block by block copy before doing anything else. I suggest copying the
encrypted version (i.e. /dev/sdb) not the decrypted one (i.e. /dev/dm-1).

Regards, Bodo
(Continue reading)

Markus Feldmann | 28 Nov 2011 18:09
Picon
Picon

Re: damaged encrypted LUKS device

Here comes my new output from <LANG=C e2fsck -n -C0 /dev/dm-1>

http://pastebin.com/raw.php?i=x0siBmrj

I will buy another 1 TByte harddisk these days and then make a 
byte-to-byte backup.

regards Markus
Bodo Thiesen | 28 Nov 2011 19:26
Picon
Picon

Re: damaged encrypted LUKS device

* Markus Feldmann <feldmann_markus <at> gmx.de> hat geschrieben:

> Here comes my new output from <LANG=C e2fsck -n -C0 /dev/dm-1>
> 
> http://pastebin.com/raw.php?i=x0siBmrj

Ok, the summary of that paste is:
| root <at> feld-bert:/home/markus# LANG=C e2fsck -n -C0 /dev/dm-1
| e2fsck 1.42-WIP (16-Oct-2011)
| e2fsck: Group descriptors look bad... trying backup blocks...
| Error writing block 1 (Attempt to write block to filesystem
|     resulted in short write). Ignore error? no
(more lines of this kind)
| e2fsck: Device or resource busy while trying to open /dev/dm-1
| Filesystem mounted or opened exclusively by another program?

And the bug report is here:
https://sourceforge.net/tracker/?func=detail&aid=3444351&group_id=2406&atid=102406

| 1. e2fsck should not try to write when using -n.
| 2. ignore error is not a question to be answered with "no" when
|    using -n but with "yes" instead.
| 3. I do not know what that "Device or resource busy" error is about
|    (someone else reported that problem on ext3-users <at> redhat.com, I'm
|    merely relaying that bug report), but it doesn't matter either: -n
|    means don't write and reading worked obviously.

> I will buy another 1 TByte harddisk these days and then make a
> byte-to-byte backup.

(Continue reading)


Gmane