[dm-crypt] Can LUKS be used on a tmpfs?

Michael Kjörling michael at kjorling.se
Wed Dec 23 20:32:00 CET 2015

On 23 Dec 2015 19:05 +0000, from hmccurdy at yahoo.com (H McCurdy):
> Is it possible to get crypt_init() to use a tmpfs instead of a block
> device or a file?

Not sure exactly what you are looking to do, but you can't put a tmpfs
on any storage-backed device. You could however create a temporary
(likely sparse) file, store that file in a tmpfs, and create a LUKS
container within that file, with a normal file system inside the
container which you can use to store data.

Would be quite a lot of overhead, though. And you need to be root to
mount a tmpfs in the first place, unless you set it up in fstab with a
"user" directive, which would sort of defeat the point.

Isn't it easier to just set appropriate permissions on a tmpfs (or
even ramfs, which would prevent ever writing the data to disk)? You'd
get pretty much the same results, minus virtually all the overhead...

Michael Kjörling • https://michael.kjorling.semichael at kjorling.se
                 “People who think they know everything really annoy
                 those of us who know we don’t.” (Bjarne Stroustrup)

More information about the dm-crypt mailing list