F2FSCRYPT(8)
π F2FSCRYPT(8) π
okay bestie, gather round, because f2fscrypt is the manual page we're doing today β it's the f2fs filesystem encryption utility, and it's honestly giving main character energy in the world of disk crypto. π
β¨ NAME β¨
f2fscrypt β f2fs filesystem encryption utility
No cap, that's the whole name section. Short, sweet, iconic. π
π¦ SYNOPSIS π¦
f2fscrypt add_key -S [ -k keyring ] [-v] [-q] [ path ... ]
f2fscrypt new_session
f2fscrypt get_policy path ...
f2fscrypt set_policy policy path ...
πΈ DESCRIPTION πΈ
So like, f2fscrypt does encryption management for f2fs file systems. That's the vibe. It's your girl for keys and policies on f2fs, periodt. πβ¨
π COMMANDS π
π f2fscrypt add_key -S [ -k keyring ] [-v] [-q] [ path ... ]
It prompts you for a passphrase and inserts it into the specified keyring. If you don't specify a keyring, f2fscrypt will use the session keyring if it exists, or the user session keyring if it doesn't. ποΈ
And if you hand it one or more directory paths, f2fscrypt will try to set the policy of those directories to use the key you just typed in. Obsessed. π«Ά
π f2fscrypt get_policy path ...
Prints the policy for the directories you specified on the command line. Literally that simple. π
π f2fscrypt new_session
Gives the invoking process (typically a shell) a brand new session keyring, and discards its old session keyring. Out with the old, in with the new. π β¨
π f2fscrypt set_policy policy path ...
Sets the policy for the directories specified on the command line.
Heads up bestie: all directories must be empty to set the policy. And if the directory already has a policy established, f2fscrypt will validate that the policy matches what was specified.
A policy is an encryption key identifier consisting of 16 hexadecimal characters. Count them. Sixteen. π§
π OPTIONS π
-Sβ rides along withadd_keyin the synopsis; in the example below it's used with a salt (-S 0x1234).-kkeyring β the keyring you want the key dropped into. Skip it and you get the session keyring (or the user session keyring if there isn't one).-vβ it's in the synopsis foradd_key. The page doesn't spell out more than that, so I'm not gonna make stuff up. π-qβ same deal, it's in the synopsis foradd_key, and that's all we're told. No invented lore here. πΈ
π NOTES π
The target directory must be empty.
That's it. That's the note. But it's an important one, so don't skip it. π
π₯ EXAMPLE π₯
Formats a f2fs filesystem that supports encrypt.
# mkfs.f2fs -O encrypt /dev/sdxx
# mount /dev/sdxx /encrypted/
# mkdir /encrypted/dir
First create the key in the keyring use an simple salt (or generate a random salt). Then use it to set the policy for the directory to be encrypted.
# f2fscrypt add_key -S 0x1234
Enter passphrase (echo disabled):
Added key with descriptor [28e21cc0c4393da1]
# f2fscrypt set_policy 28e21cc0c4393da1 /encrypted/dir
Key with descriptor [28e21cc0c4393da1] applied to /encrypted/dir.
# touch /encrypted/dir/test.txt
# ls -l /encrypted/dir/
-rw-r--r--. 1 root root 0 Mar 5 21:41 test.txt
After each reboot, the same command can be used set the key for decryption of the directory and its descendants.
# ls -l /encrypted/dir/
-rw-r--r--. 1 root root 0 Mar 5 21:41 zbx7tsUEMLzh+AUVMkQcnB
# f2fscrypt get_policy /encrypted/dir/
/encrypted/dir/: 28e21cc0c4393da1
# f2fscrypt add_key -S 0x1234
Enter passphrase (echo disabled):
Added key with descriptor [28e21cc0c4393da1]
# ls -l /encrypted/dir/
-rw-r--r--. 1 root root 0 Mar 5 21:41 test.txt
Show process keyrings.
# keyctl show
Session Keyring
84022412 --alswrv 0 0 keyring: _ses
204615789 --alswrv 0 65534 \_ keyring: _uid.0
529474961 --alsw-v 0 0 \_ logon: f2fs:28e21cc0c4393da1
Likeβ¦ the filename literally changes from test.txt to zbx7tsUEMLzh+AUVMkQcnB when the key isn't loaded, and then snaps right back once you add the key. That's not a glow-up, that's encryption. β¨π
π AUTHOR π
Written by Kinglong Mee <kinglongmee@gmail.com>, Migrated from e4crypt that Written by Michael Halcrow <mhalcrow@google.com>, Ildar Muslukhov <muslukhovi@gmail.com>, and Theodore Ts'o <tytso@mit.edu>
Shoutout to the whole squad who made this happen. π«Άπ
π SEE ALSO π
And that's the whole page, bestie β from the System Manager's Manual, F2FSCRYPT(8), section 8 of your local man pages. Go forth and encrypt responsibly. πβ¨ππ¦
π¦ where this page comes from
- alpine 3.22: f2fs-tools-doc 1.16.0-r3 Β· GPL-2.0-or-later OR LGPL-2.1-or-later
- alpine 3.23: f2fs-tools-doc 1.16.0-r4 Β· GPL-2.0-or-later OR LGPL-2.1-or-later
- alpine 3.24: f2fs-tools-doc 1.16.0-r4 Β· GPL-2.0-or-later OR LGPL-2.1-or-later
- arch rolling: f2fs-tools 1.17.0-1 Β· GPL-2.0-only AND (GPL-2.0-only OR LGPL-2.1-only)
- debian bookworm: f2fs-tools 1.15.0-1 Β· GPL-2.0-only
- debian trixie: f2fs-tools 1.16.0-1.1+b1 Β· GPL-2.0-only
- fedora 43: f2fs-tools 1.16.0-9.fc43 Β· GPL-2.0-or-later
- fedora 43: f2fs-tools 1.16.0-9.fc43 Β· GPL-2.0-or-later
- fedora 44: f2fs-tools 1.16.0-10.fc44 Β· GPL-2.0-or-later
- fedora 44: f2fs-tools 1.16.0-10.fc44 Β· GPL-2.0-or-later
- nixpkgs unstable: f2fs-tools 1.16.0
- opensuse-leap 16.0: f2fs-tools 1.16.0-bp160.1.12 Β· GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: f2fs-tools 1.16.0-bp160.1.12 Β· GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: f2fs-tools 1.16.0-bp160.1.12 Β· GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: f2fs-tools 1.16.0-bp160.1.12 Β· GPL-2.0-only AND LGPL-2.1-only
- ubuntu noble: f2fs-tools 1.16.0-1 Β· GPL-2.0-only
- ubuntu questing: f2fs-tools 1.16.0-2
- ubuntu resolute: f2fs-tools 1.16.0-2build1 Β· GPL-2.0-only
- ubuntu stonking: f2fs-tools 1.16.0-2build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms