2

Hey wonderful Ask Ubuntu Community,

on my new Laptop I want to access the LUKS encrypted data on some old hard drives which where used in my old computers.

Long story short: Unfortunately it seems I am not able to activate the volumegroup using sudo vgchange -ay getting device busy:

sudo vgchange -ay
device-mapper: create ioctl on vgubuntu-root LVM-SelHt8NeMlYbL68cnLF0t64jwxkcrLURglB0Elk4hnQizRDiXDKJjQBITSJN7Sfx failed: Das Gerät oder die Ressource ist belegt
device-mapper: create ioctl on vgubuntu-swap_1 LVM-SelHt8NeMlYbL68cnLF0t64jwxkcrLURaV8upU0JXaoUg20OQV21tWbNnIsjwMna failed: Das Gerät oder die Ressource ist belegt

Long story long:

I attached the old disk containing the OS and LUKS data via SATA-USB Adapter. It gets reconised and Ubuntu asks me for the password. I enter the LUKS Password and the boot partition gets mounted. In Drives I see the disk (sda) and the LUKS Partition (sda6) is unlocked and a LVM2 partition of the same size is present.
I use sudo lvscan to scan for logical volumes and for sda I get:

sda                                             8:0    0 232,9G  0 disk
├─sda1                                          8:1    0   512M  0 part  /media/Username/1EDD-E50C
├─sda2                                          8:2    0     1K  0 part  
├─sda5                                          8:5    0   731M  0 part  /media/Username/9a46f5fa-e8e7-4bb7-b073-5ed7005e6ad2
└─sda6                                          8:6    0 231,7G  0 part
  └─luks-9f6c23d7-8fa3-4a3b-a979-d12bb83edec4 253:3    0 231,7G  0 crypt 

Now I use "sudo lvscan" to scan for logical volumes:

inactive          '/dev/vgubuntu/root' [230,66 GiB] inherit
inactive          '/dev/vgubuntu/swap_1' [976,00 MiB] inherit
ACTIVE            '/dev/vgubuntu/root' [<930,37 GiB] inherit
ACTIVE            '/dev/vgubuntu/swap_1' [976,00 MiB] inherit

Ok I see my LUKS data seems inactive. I try to activate it with sudo vgchange -ay getting device busy error mentioned above:

sudo vgchange -ay
device-mapper: create ioctl on vgubuntu-root LVM-SelHt8NeMlYbL68cnLF0t64jwxkcrLURglB0Elk4hnQizRDiXDKJjQBITSJN7Sfx failed: Das Gerät oder die Ressource ist belegt
device-mapper: create ioctl on vgubuntu-swap_1 LVM-SelHt8NeMlYbL68cnLF0t64jwxkcrLURaV8upU0JXaoUg20OQV21tWbNnIsjwMna failed: Das Gerät oder die Ressource ist belegt

I try ls -al /dev/mapper/ and get:

insgesamt 0
drwxr-xr-x  2 root root     140 Mai 15 09:57 .
drwxr-xr-x 24 root root    5340 Mai 15 09:57 ..
crw-------  1 root root 10, 236 Mai 15 08:58 control
lrwxrwxrwx  1 root root       7 Mai 15 09:57 luks-9f6c23d7-8fa3-4a3b-a979-d12bb83edec4 -> ../dm-3
lrwxrwxrwx  1 root root       7 Mai 15 08:58 nvme0n1p3_crypt -> ../dm-0
lrwxrwxrwx  1 root root       7 Mai 15 08:58 vgubuntu-root -> ../dm-1
lrwxrwxrwx  1 root root       7 Mai 15 08:58 vgubuntu-swap_1 -> ../dm-2

So I try to mount the luks partition with sudo mount /dev/dm-3 /media/Username/SSD_Crypt and get unknown filesystem type "LVM2_member:

mount: /media/carsten/SSD_Crypt: unbekannter Dateisystemtyp „LVM2_member“.

From here I am lost, since I verified with sudo apt-get install lvm2 lvm2 is installed.


I also gathered some additional info but I am not getting through it:

Output of sudo pvscan:

PV /dev/mapper/luks-9f6c23d7-8fa3-4a3b-a979-d12bb83edec4   VG vgubuntu        lvm2 [231,65 GiB / 36,00 MiB free]
PV /dev/mapper/nvme0n1p3_crypt                             VG vgubuntu        lvm2 [<952,64 GiB / <21,32 GiB free]

Output of sudo vgscan:

Found volume group "vgubuntu" using metadata type lvm2
Found volume group "vgubuntu" using metadata type lvm2

To me it seems the volumegroup of the old disk is the same es the one of the Disk in the new System and therefore can not be activated. But I do neither know if this is the cause of the problem nor how to solve it.


To repeat my goal: I want to access the LUKS encrypted Data from an old Disk which was used to boot in an old computer on a new Ubuntu computer which also uses LUKS encryption. Probably I am mixing something up as my understanding of LUKS is limited. I would really appreciate if you could give me some hints or even better steps to reproduce to mount my old LUKS encrypted data.

eX00r
  • 301
  • 1
  • 3
  • 11
  • My guess is it's that logical volume management that makes things complicated. If you know which of the partitions (sda1, sda2, sda5, sda6) you want to mount, try opening it directly using something like sudo cryptsetup luksOpen /dev/sdax crypt and then mounting /dev/mapper/crypt somewhere, but before entering any password when you connect the drive. – Sebastian May 15 '21 at 09:49
  • Thanks for your quick reply. I just tried what you proposed and it turns out I get the same error 'unknown Filesystem type "LVM2_member": mount: /media/Username/SSD_Crypt: unbekannter Dateisystemtyp „LVM2_member“. – eX00r May 15 '21 at 10:24

1 Answers1

2

Found the answer. It was as I guessed: The volumegroups of the new OS Harddisks and the old OS Harddisks being the same (vgubuntu) was blocking the activation of the old data on the new system.

You need to change the volumegroup as described here and than you can activate the volumegroup and simply mount:

  1. get the UUID of the old volumegroup

sudo vgdisplay

  1. rename it to a new name

sudo vgrename new_name

  1. apply

modprobe dm-mod

  1. activate volumegroups

vgchange -ay

  1. scan

lvscan

  1. mount

mount /dev/new_name/root /mnt/data/

eX00r
  • 301
  • 1
  • 3
  • 11