10

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.

  • 2
    I'm almost sure enough to provide this as an answer but not quite. You did umount and that should be enough. The dmcrypt layer shouldn't be holding on to any uncommitted data after that. – Celada Jul 3 '14 at 1:40
3

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.

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.