forgot to luksClose usb persistent partition, is this a problem?

Following the Kali Linux documentation for “Adding USB Persistence with LUKS Encryption”, I created a persistent partition and encrypted the volume with:

cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb2
cryptsetup luksOpen /dev/sdb2 my_usb
mkfs.ext3 -L persistence /dev/mapper/my_usb
e2label /dev/mapper/my_usb persistence
mkdir -p /mnt/my_usb
mount /dev/mapper/my_usb /mnt/my_usb
echo "/ union" > /mnt/my_usb/persistence.conf
umount /dev/mapper/my_usb

(substituting a volume name for “my_usb”)

However, I forgot to close the volume (the following line was ophaned on the next page in the documentation, so I didn’t see it):

cryptsetup luksClose /dev/mapper/my_usb

Is this a problem? If so, how and is there any way to repair it?

This article suggests it is but doesn’t say why and the instructions don’t work for me.

The disk appears to work fine.

Asked By: Deirdre Hendrick


Forgetting the luksClose doesn’t harm the data on the disk, after the umount, everything is flushed to the disk, so you are safe at this point.

What the article you linked is talking about is that without the luksClose, the device mapper mapping for the crypt device is still lingering around, which blocks the name my_usb for any future luksOpen (of the same or another crypt disk) until the machine is rebooted or the manual removal procedure from the article is done. This doesn’t affect any data on the disk even if you reconnect it, it is just a nuisance.

Answered By: aferber
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.