I was trying to mount an encrypted SD card on Kubuntu 20.04.

lsblk gives me this:

NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                                           7:0    0  97,9M  1 loop  /snap/core/10577
loop1                                           7:1    0  97,9M  1 loop  /snap/core/10583
loop2                                           7:2    0  55,4M  1 loop  /snap/core18/1932
loop3                                           7:3    0  55,4M  1 loop  /snap/core18/1944
loop4                                           7:4    0  64,8M  1 loop  /snap/gtk-common-themes/1514
loop5                                           7:5    0  64,4M  1 loop  /snap/gtk-common-themes/1513
sda                                             8:0    0 931,5G  0 disk  
├─sda1                                          8:1    0   512M  0 part  /boot/efi
├─sda2                                          8:2    0     1K  0 part  
├─sda5                                          8:5    0   731M  0 part  /boot
└─sda6                                          8:6    0 930,3G  0 part  
  └─sda6_crypt                                253:0    0 930,3G  0 crypt 
    ├─vgkubuntu-root                          253:1    0 929,3G  0 lvm   /
    └─vgkubuntu-swap_1                        253:2    0   976M  0 lvm   [SWAP]
sr0                                            11:0    1  1024M  0 rom   
mmcblk0                                       179:0    0 238,5G  0 disk  
└─mmcblk0p1                                   179:1    0 238,5G  0 part  
  └─luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 253:3    0 238,5G  0 crypt

After creating an empty directory to be used as mount point, I tried to mount the different /dev that correspond to the SD Card with following output.

sudo mount /dev/mmcblk0p1 /media/alex/SDcard
mount: /media/alex/SDcard: unknown filesystem type 'crypto_LUKS'.

sudo mount /dev/mmcblk0 /media/alex/SDcard
mount: /media/alex/SDcard: /dev/mmcblk0 already mounted or mount point busy.

(I don't know why it says mounted or mount point busy. I've previously unmounted the SD Card in Dolphin file browser.)

sudo mount /dev/luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 /media/alex/SDcard
mount: /media/alex/SDcard: special device /dev/luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 does not exist.

However, I figured out merely by chance, that this following command works and mounts the SD card and I can access it at the mount point.

sudo mount /dev/dm-3 /media/alex/SDcard

My question is now where does this /dev/dm-3 come from?
/dev/dm-3 is neither mentioned in lsblk nor in fdisk -l or gdisk -l /dev/mmcblk0. Would there have been any other way to find it if not by chance?


Device encryption is implemented using a kernel framework called device mapper (that's where the dm-3 comes from, it's a third device mapper device in your system). "Mounting" an encrypted device has two steps:

  1. Unlocking/opening the device (in your case the first partition on your SD card). You already did this step (or KDE did that for you) and result of it is creation of a device mapper device on top of the partition, which from system point of view is a normal unencrypted device (but all writes to it are encrypted before writing the data to the "real" underlying device) and can be mounted. The device mapper device has by default two paths -- /dev/dm-X (/dev/dm-3) and "human readable" /dev/mapper/<name> where "name" is (for LUKS/dm-crypt devices) usually luks-<UUID>.
  2. Mounting the device mapper device (or actually filesystem on it) produced in step 1. To mount it you need to use full path so either /dev/dm-3 or /dev/mapper/luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 in your case.
sudo mount /dev/mmcblk0p1 /media/alex/SDcard

This didn't work because the encrypted device (with LUKS/dm-crypt format) can't be mounted directly.

sudo mount /dev/mmcblk0 /media/alex/SDcard

This says "device is busy" because you are trying to mount a disk with a partition that has an unlocked LUKS device on it, so it is busy. (Mounting disk with partitions and not the partition wouldn't work anyway.)

sudo mount /dev/luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 /media/alex/SDcard

This was close, you are missing the mapper part of the path.

My question is now where does this /dev/dm-3 come from? /dev/dm-3 is neither mentioned in lsblk nor in fdisk -l or gdisk -l /dev/mmcblk0. Would there have been any other way to find it if not by chance?

dm-3 is "system name" and is usually not shown to users because it changes between reboots and is hard to find out which device mapper is which using this name in general. Most tools will show the "nice" /dev/mapper/luks-da818ea9-1681-4c54-93b4-e2cc6529e8f7 path which is symlink to /dev/dm-3.

If you want to mount encrypted devices manually and not using Dolphin (which will both unlock and mount the device) to do that, you need to use lsblk to identify the name that UDisks (tool that KDE uses for working with devices) gave it and then remember the path prefix is /dev/mapper in this case.

  • If I can't have KDE unlock the device for me, would this be a safe way? cryptsetup open /dev/mmcblk0p1 foo and then mount /dev/mapper/foo /media/alex/SDcard Because I think I'm not supposed to interact directly with udisks, right? – alex135 Jan 24 at 22:23
  • You can use UDisks to do that: udisksctl unlock -b /dev/mmcblk0p1 and udisksctl mount -b /dev/mapper/luks-... but your approach will also work. – Vojtech Trefny Jan 25 at 6:46

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.