Mount LVM encrypted partition on external HDD - Device /dev/sdc5 is not a valid LUKS device
First, check if the partition is really encrypted :
#cryptsetup -v luksDump /dev/sdc5
#Command failed with code 22: Device /dev/sdc5 is not a valid LUKS device.
oups, this volume wasn't actually encrypted :( so then
#lvscan
inactive '/dev/serveur/root' [464,48 GiB] inherit
inactive '/dev/serveur/swap_1' [1012,00 MiB] inherit
so we need to activate it:
#modprobe dm-mod
#vgchange -ay
and then simply mount the partition :
#mount /dev/serveur/root /media/rescue/
I thought my HDD was defected, and LVM volume encrypted, but it wasn't the case. So next time I'll think more simple, and I'll try the basics first.
Related videos on Youtube
Comments
-
Sulliwane over 1 year
Recently, my Ubuntu server was unable to boot on my 500Go HDD
I removed the HDD from my server case, put it in an external case, and connected it via USB to an Ubuntu laptop.
I have SSH access on this Ubuntu laptop. I can see the boot partition of the server HDD here :
poste3@poste3:/media$ df -h /dev/sdc1 228M 27M 189M 13% /media/poste3/695e74fd-83bb-4489-bf3b-51d256885fc9
I can list the content of this partition :
poste3@poste3:/media/poste3/695e74fd-83bb-4489-bf3b-51d256885fc9$ ls abi-3.2.0-38-generic memtest86+.bin config-3.2.0-38-generic memtest86+_multiboot.bin grub System.map-3.2.0-38-generic initrd.img-3.2.0-38-generic vmlinuz-3.2.0-38-generic lost+found
So it means that the disk is still readable, even with some defected sectors.
When I installed Ubuntu Server on this HDD, I remember I choose Use entire disk and set up encrypted LVM.
root@poste3:/home/poste3# fdisk -l /dev/sdc Disk /dev/sdc: 500.1 GB, 500106779648 bytes 255 têtes, 63 secteurs/piste, 60801 cylindres, total 976771054 secteurs Unités = secteurs de 1 * 512 = 512 octets Taille de secteur (logique / physique) : 512 octets / 512 octets taille d'E/S (minimale / optimale) : 512 octets / 512 octets Identifiant de disque : 0x000d3d72 Périphérique Amorce Début Fin Blocs Id Système /dev/sdc1 * 2048 499711 248832 83 Linux /dev/sdc2 501758 976769023 488133633 5 Étendue /dev/sdc5 501760 976769023 488133632 8e LVM Linux
so I did the following :
sudo apt-get install lvm2 cryptsetup sudo modprobe dm-crypt cryptsetup luksOpen /dev/sdc5 crypt Device /dev/sdc5 is not a valid LUKS device.
Can you help me to mount this partition ? I don't understand why it fails...is it because physical defects in the disk ? Thanks