How to close a luks container that has sub partitions
<p>For example this creates 1 partition on /dev/sda, as /dev/sda1, which is turned into a LUKS container, which is further partitioned into 2 sub partitions:</p>

<pre><code>sgdisk -Z /dev/sda
sgdisk -n 1:0:0 -t 1:8300 -c 1:"Test Partition" /dev/sda

cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 1000 --use-urandom luksFormat /dev/sda1
cryptsetup luksOpen --allow-discards "test_encrypted"

sgdisk -Z /dev/mapper/test_encrypted
sgdisk -n 1:0:+6GB -t 1:8300 -c 1:"sub_test_1" /dev/mapper/test_encrypted
sgdisk -n 2:0:0 -t 2:8300 -c 2:"sub_test_2" /dev/mapper/test_encrypted

partprobe -s /dev/mapper/test_encrypted

lsblk

cryptsetup luksClose test_encrypted
</code></pre>

<p>Trying to do so, gives back: <code>device-mapper: remove ioctl on test_encrypted failed: Device or resource busy</code>, then <code>Device test_encrypted is still in use</code>.</p>

<p>The sub partitioning works, but one cannot close it anymore once partprobe has reported to the kernel about the sub partitions.</p>