0

I was given a HDD that was encrypted using dm-crypt and I'd like to mount it as /disk2 preferably having the decryption password stored in a file, so I won't have to enter the passphrase when booting, but it's not that important.

When I try to open the disk in the file manager providing the encryption passsword, I get this error

Failed to mount "500 GB LVM2 Physical Volume".
Not a mountable file system.

lvdisplay gives

LV Path /dev/disk2/disk2
LV Name disk2
VG Name disk2
LV Status              NOT available

ls /dev/mapper gives the following, while the desired result should be disk2-disk2 I guess

udisks-luks-uuid-.....-uid1000

dmsetup ls --tree returns

udisks-luks-uuid-.....-uid1000 (253:7)
└─ (8:17)

lvs returns

disk2 disk2 -wi----- 465,75g

lsblk (before decryption) returns

sdb                       8:16   0 465,8G  0 disk
└─sdb1                    8:17   0 465,8G  0 part

lsblk returns

sdb                       8:16   0 465,8G  0 disk
└─sdb1                    8:17   0 465,8G  0 part
  └─udisks-luks-uuid-.....-uid1000 (dm-7) 253:7    0 465,8G  0 crypt

mount /dev/mapper/disk2 /mnt returns

mount: unknown filesystem type 'LVM2_member'

fdisk -l /dev/sdb returns

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot      Start         End      Blocks   Id  System /dev/sdb1   1   976773167   488386583+  ee  GPT
Partition 1 does not start on physical sector boundary.

migrated from serverfault.com Feb 23 '15 at 12:55

This question came from our site for system and network administrators.

  • What exactly did you do to decrypt the disk: did you use a GUI (which one) or a command line? What is the output of dmsetup ls --tree and lvs? – Gilles Feb 23 '15 at 13:05
  • I opened it on Xfce desktop, the same can be done in Thunar. dmsetup ls --tree:udisks-luks-uuid-.... lvs:disk2 disk2 -wi----- 465,75g – user965748 Feb 23 '15 at 14:29
  • Edit your question, this information isn't readable in a comment due to the lack of newlines. And please report the information more faithfully, the way you're anonymizing it loses information. E.g. leave sda3 or whatever it is alone, and keep the volume group name, etc. From what you've posted, it seems that the volume is not encrypted, since the logical volume is not on a physical volume that's encrypted. – Gilles Feb 24 '15 at 8:14
  • I have edited my question. If I don't provide the encryption password, then ls /dev/mapper, lvs, dmsetup ls --tree, lvdisplay don't show this disk at all, therefor it has to be encrypted. – user965748 Feb 24 '15 at 10:40
  • This is the dialog displayed after clicking the desktop drive icon oi60.tinypic.com/i1z3o6.jpg – user965748 Feb 24 '15 at 10:56
5
+100

You have to remember there are two layers of abstraction involved here. You don't "mount" an encrypted disk. You open the encrypted disk with cryptsetup (if you have the correct password). This will create a mapping of the de-crypted partition at /dev/mapper/foo. Then you can mount /dev/mapper/foo to your desired mountpoint (such as /disk2). These are two separate steps.

If /dev/mapper/foo is not formatted (i.e. ext4) then you cannot mount it.

To your other question, how do you automate the decrypting by using a key stored on your disk. Use the option --key-file, i.e:

cryptsetup luksOpen /dev/sdb1 sdb1 --key-file /path/to/your/key
1

To mount an encrypted drive you just have to identify your encrypted drive and partition (lets say it is sdb1).

Run the command

cryptsetup luksOpen /dev/sdb1 EncHDD

You will have to introduce your passphrase and a new device will be created under /dev/mapper called EncHDD. After that

mount /dev/mapper/EncHDD /mnt

and you will be ready to go.

Your problem is that your drive seems to be an LVM partitioned drive (run fdisk -l /dev/yourdrive to identify the partitioning scheme) if it was the only drive of the physical/logical volume you may be able to recreate it, if it was part of a physical volume grup and the other drives are missing you will never be able to recreate the volume group thus you will never be able to decrypt it.

Here you have a guide to LVM in case you may need it.

  • I added responses to your commands into my Q. BTW originally the disk was mounted as volume group disk2, partition disk2 – user965748 Feb 25 '15 at 12:00
0

This sequence allowed me to access the data

cryptsetup luksOpen /dev/sdb1 disk2
modprobe dm-mod
vgchange -ay
mount /dev/disk2/disk2 /disk2

So I offer the reward to the one who'll tell me how to make this change permanent.

  • I'd like to know why this answer has already received -3. – user965748 Feb 28 '15 at 19:31

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.