f2fs supports per-file encryption, however I can't find any resources about it.

  • I know about eCryptFS, LUKS and encfs, that's not the same.
  • I can't find anything on this either. I'd like to. – xendi Dec 24 '16 at 15:59
  • ATM there's no cli tool to do that afaik. You'll have to write your own if you want to encrypt on f2fs, prolly similar to this guy's ext4-crypt – don_crissti Dec 25 '16 at 21:54

f2fs-tools includes, as of v.1.9, a tool for encryption management in the f2fs filesystem:


The manual page includes an example that shows how to encrypt a directory (along with instructions on how to setup a f2fs filesytem that supports encryption).

The only alternative to f2fscrypt that I know of is fscryptctl (I only tried it once and it was on a ext4 filesystem but according to the author it should work equally well on f2fs).


When enabling support to the filesystem in the Linux kernel, it is wise to enable at least the first four options in order to support extended filesystem attributes:


Enabling basic f2fs filesystem options

File systems  --->
   <*> F2FS filesystem support
   [*]   F2FS extended attributes
   [*]     F2FS Access Control Lists
   [*]     F2FS Security Labels
   [*]   F2FS consistency checking feature
   [*]   F2FS Encryption

Install the user space tools for the f2fs filesystem:

root #emerge --ask sys-fs/f2fs-tools

After emerging the userspace tools, create a filesystem by running the mkfs.f2fs command followed by the appropriate device and partition number:

root #mkfs.f2fs /dev/sdd1

Now at this point, afiak, we can do something like this: http://www.linuxquestions.org/questions/linux-security-4/how-to-use-f2fs-encryption-4175581121/ or this: http://blog.quarkslab.com/a-glimpse-of-ext4-filesystem-level-encryption.html. Will they play nice with trim? I'm not sure. I've been trying to get to the bottom of this for a while now and this is the best I can come up with.

  • The question here is how to encrypt using f2fs per-file encryption (without using ecryptfs as in your first link... I'm not going to comment on your second link for obvious reasons...) – don_crissti Feb 10 '17 at 15:40

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.