Question re: Mounting Encrypted LVM Partition

Forum rules
Before you post please read this
mikemoceri
Level 1
Level 1
Posts: 5
Joined: Wed Jun 24, 2015 7:33 pm

Question re: Mounting Encrypted LVM Partition

Postby mikemoceri » Wed Jun 24, 2015 7:41 pm

Hello,

So, my motherboard went kaput last week, and I have vital legal documents on an encrypted drive. After attaching said drive to an external bay, I appear to be able to decrypt it fine with sudo cryptsetup -v luksOpen /dev/sdc3 external, leading to the following output:

Code: Select all

Enter passphrase for /dev/sdc3:
Key slot 0 unlocked.
Command successful.


The output for ls /dev/mapper/ is as follows:

Code: Select all

control  external  mint--vg-root  mint--vg-swap_1


However, when I run sudo mount /dev/mapper/external /media/external/, I get the following error:

Code: Select all

mount: unknown filesystem type 'LVM2_member'


I'm pretty sure I have LVM installed, since my root drive uses LVM. Why am I getting this error?

-Mike

Laurent85
Level 13
Level 13
Posts: 4810
Joined: Tue May 26, 2015 10:11 am

Re: Question re: Mounting Encrypted LVM Partition

Postby Laurent85 » Thu Jun 25, 2015 7:11 am

mikemoceri wrote:However, when I run sudo mount /dev/mapper/external /media/external/, I get the following error:

Code: Select all

mount: unknown filesystem type 'LVM2_member'

Root filesystem is mint--vg-root, copy/paste command :

Code: Select all

sudo mount /dev/mapper/mint--vg-root /mnt
Image

mikemoceri
Level 1
Level 1
Posts: 5
Joined: Wed Jun 24, 2015 7:33 pm

Re: Question re: Mounting Encrypted LVM Partition

Postby mikemoceri » Mon Jun 29, 2015 1:14 pm

I'm pretty sure that the mint--vg-root in the output of "ls /dev/mapper/" is referring to my root partition, since I'm running all of this on mint. Note that I ran "sudo cryptsetup -v luksOpen /dev/sdc3 external" previously, so I think that the one I should be mounting is "external."

Laurent85
Level 13
Level 13
Posts: 4810
Joined: Tue May 26, 2015 10:11 am

Re: Question re: Mounting Encrypted LVM Partition

Postby Laurent85 » Mon Jun 29, 2015 3:44 pm

So why trying to mount /dev/mapper/external ? You wrote
mikemoceri wrote:However, when I run sudo mount /dev/mapper/external /media/external/ , I get the following error:

Code: Select all

mount: unknown filesystem type 'LVM2_member'

I'm pretty sure I have LVM installed, since my root drive uses LVM. Why am I getting this error?
Image

mikemoceri
Level 1
Level 1
Posts: 5
Joined: Wed Jun 24, 2015 7:33 pm

Re: Question re: Mounting Encrypted LVM Partition

Postby mikemoceri » Tue Jun 30, 2015 3:00 pm

I thought that's how you're supposed to mount LVM volumes. Is there something I'm missing here?

mikemoceri
Level 1
Level 1
Posts: 5
Joined: Wed Jun 24, 2015 7:33 pm

Re: Question re: Mounting Encrypted LVM Partition

Postby mikemoceri » Tue Jun 30, 2015 7:36 pm

To clarify: I'm trying to recover my encrypted home partition from ANOTHER mint system which went kaput. My current PC (the one that works) is ALSO running Linux Mint 17.1 Rebecca. The hard drive I'm trying to recover from is labeled sdc, and I believe the correct partition is sdc3 (Luks can decrypt it just fine with my password).

Laurent85
Level 13
Level 13
Posts: 4810
Joined: Tue May 26, 2015 10:11 am

Re: Question re: Mounting Encrypted LVM Partition

Postby Laurent85 » Wed Jul 01, 2015 3:50 am

Ok perhaps you missed my previous post with correct mount command. Unlock drive as you have already done then copy/paste command :

Code: Select all

sudo mount /dev/mapper/mint--vg-root /mnt
Image

User avatar
Derek_S
Level 6
Level 6
Posts: 1236
Joined: Sat Dec 28, 2013 5:36 pm
Location: Long Island, N.Y.

Re: Question re: Mounting Encrypted LVM Partition

Postby Derek_S » Tue Jul 21, 2015 11:40 pm

mikemoceri wrote:I thought that's how you're supposed to mount LVM volumes. Is there something I'm missing here?


Hello mikemoceri - I know this thread is a bit long in the tooth and I'm sorry for not coming across it sooner.

Here's the procedure I used on my own system, so I can vouch for the fact that it does work. Terminal commands as follows:

1.) sudo apt-get install cryptsetup lvm2 ### These two packages should already be installed, do this just to make sure

2.) sudo modprobe dm-crypt ### Verify the kernel module dm-crypt is active

3.) sudo modprobe dm-mod ### Verify the kernel module dm-mod is active

4.) sudo cryptsetup luksOpen /dev/sdc3 MYDATA ### Unlock the LUKS partition and label it MYDATA; this assumes sdc3 is the encrypted partition

5.) sudo vgscan ### Scan for volume groups; you should find volume group "mint-vg" in the output

6.) sudo vgchange -ay mint-vg ### Make the volume group mint-vg active as well as all of the logical volumes it contains

7.) sudo lvscan ### Scan for logical volumes in the volume group; you should find the logical volume "/dev/mint-vg/root" in the output

8.) sudo mkdir /media/root ### Create a new directory /media/root in order to mount the logical volume /dev/mint-vg/root

9.) sudo mount /dev/mint-vg/root /media/root ### Mount the logical volume /dev/mint-vg/root as /media/root

At this point you should see an icon for /media/root appear on the Desktop. You will be able to copy all of your data files from /media/root over to your new system or to a pre-formatted USB flash drive if you're running from a live CD session. When you're done, unmount as follows:

10.) sudo umount /media/root ### Unmount /media/root

11.) sudo cryptsetup luksClose MYDATA ### Lock the encrypted partition; I got an error message here, but it really doesn't matter since you've already saved your data and will be shutting down
If Bill Gates had a nickel for every time Windows crashed . . . . . oh wait, he does.

karamjeet
Level 1
Level 1
Posts: 11
Joined: Mon Nov 20, 2017 4:29 am

Re: Question re: Mounting Encrypted LVM Partition

Postby karamjeet » Tue Nov 21, 2017 1:55 am

Hello @Derek_S
Thanks for posting this answer, i have been following this answer to mount my encryption partition due to initrafs error of Busybox 1.21.1.
Upto 8th point number from your commands its success for me

mint@mint ~ $ sudo apt-get install cryptsetup lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
cryptsetup is already the newest version.
lvm2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mint@mint ~ $ sudo modprobe dm-crypt
mint@mint ~ $ sudo modprobe dm-mod
mint@mint ~ $ sudo cryptsetup luksOpen /dev/sd
sda sda1 sda2 sda3 sda5 sdb sdb1 sdc
mint@mint ~ $ sudo cryptsetup luksOpen /dev/sda5 MYDATA
Enter passphrase for /dev/sda5:
mint@mint ~ $ sudo vgscan
Reading all physical volumes. This may take a while...
Found volume group "mint-vg" using metadata type lvm2
mint@mint ~ $ sudo vgchange -ay mint-vg
2 logical volume(s) in volume group "mint-vg" now active
mint@mint ~ $ sudo lvscan
ACTIVE '/dev/mint-vg/root' [927.32 GiB] inherit
ACTIVE '/dev/mint-vg/swap_1' [3.90 GiB] inherit
mint@mint ~ $ sudo mkdir /media/root


but when i ran command #9 there is problem like i have shown as follows:


mint@mint ~ $ sudo mount /dev/mint-vg/root /media/root
mount: wrong fs type, bad option, bad superblock on /dev/mapper/mint--vg-root,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Please let me know for further info if required.


Return to “Mounting Partitions”