I'm really confused by the ways an encrypted partition get mounted.
If I use the normal mount command:
# mount /dev/sda2 /mnt/sda2
It just mounts the partition without asking for the passphrase used to create it. I can list the files in /mnt/sda2, create a new file test.txt, but have no access to the files written to the "real encrypted partition".
But if I unmount /mnt/sda2, and mount it again with
# cryptsetup luksOpen /dev/sda2 vault
# mount /dev/mapper/vault /mnt/sda2
Then I can see/change the content of the encrypted partition but without being able to see/change the file test.txt created previously with the normal mount command.
The reason I'm asking is that I'm having my custom Debian to automount every partition available on the system at boot time. Is there any way/command to tell if a particular partition is encrypted (by cryptsetup) or not? So that I can mount it the right way and not make the users confused (or even harm the encrypted data).
Thanks for your consideration.