LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   luks encrypted, unlocked partition does not appear in /dev/, despite fdisk seeing it (https://www.linuxquestions.org/questions/linux-software-2/luks-encrypted-unlocked-partition-does-not-appear-in-dev-despite-fdisk-seeing-it-4175594290/)

sellerie 11-26-2016 06:57 PM

luks encrypted, unlocked partition does not appear in /dev/, despite fdisk seeing it
 
Hello dear community.

I've been using Linux for quite a while now (1 year in daily home- and work use now),
And I'm using Arch Linux as daily for a few months now. (Currently running kernel version 4.8.10-1-ARCH)
and I've started using luks/dm-crypt to encrypt some partitions of some harddrive.
I'm pretty new to using it, and I've recently tried to create a luks encrypted container on my external harddrive,
which I created a mbr(dos) table in and created an ext4 partition in,
but I'm not able to mount the partition in this table anymore,
since the partition doesnt appear anymore after unlocking the container.

Interestingly, fdisk still sees the partition in this container and gets recognized as:
Code:

Festplatte /dev/mapper/test: 512 GiB, 549753716736 Bytes, 1073737728 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0x2714606d

Gerät                  Boot Anfang      Ende  Sektoren Größe Kn Typ
/dev/mapper/test-part1        2048 1073737727 1073735680  512G 83 Linux

But that device neither exists in /dev/mapper (I tried *-part, *p1 and also *-p1),
nor does it appear in /dev/disk/by-name/ or /dev/disk/by-uuid or anywhere else.
I was once able to mount the partition,
but now its not possible anymore :(
Anyone having a clue why?

rknichols 11-26-2016 07:59 PM

Having a partitioned device inside a LUKS container is pretty unusual. Probing for partitions inside that container is not going to be automatic. You need to tell the kernel to do it:
Code:

kpartx -av /dev/mapper/test
Use "kpartx -dv /dev/mapper/test" to remove the mappings. You will need to do that before you can close the LUKS container.

syg00 11-26-2016 09:29 PM

Also, no point having the block device at all if only one partition - normal practice would be to mkfs on the (unlocked) container itself.

sellerie 11-27-2016 04:35 AM

Thanks for the swift answers!
Partprobing on /dev/*lukscontainer* actually solved it for me.
Funny that I didnt have the idea partprobing after unlocking manually myself makes me wonder lol.

@syg00 Realized that now too, already had this once, but I wondered that dolphin is a bit weirdly behaving when partitioning in some container directly, but its behaving more weirdly vice versa...


All times are GMT -5. The time now is 06:48 AM.