mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 13:41:26 +00:00
5f8d14546b
* manual: Mark commands that require root Mark every command that requires to be run as root by prefixing them with '#' instead of '$'. * manual: Add note about commands that require root
43 lines
1.4 KiB
XML
43 lines
1.4 KiB
XML
<section xmlns="http://docbook.org/ns/docbook"
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
version="5.0"
|
|
xml:id="sec-luks-file-systems">
|
|
|
|
<title>LUKS-Encrypted File Systems</title>
|
|
|
|
<para>NixOS supports file systems that are encrypted using
|
|
<emphasis>LUKS</emphasis> (Linux Unified Key Setup). For example,
|
|
here is how you create an encrypted Ext4 file system on the device
|
|
<filename>/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d</filename>:
|
|
|
|
<screen>
|
|
# cryptsetup luksFormat /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d
|
|
|
|
WARNING!
|
|
========
|
|
This will overwrite data on /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d irrevocably.
|
|
|
|
Are you sure? (Type uppercase yes): YES
|
|
Enter LUKS passphrase: ***
|
|
Verify passphrase: ***
|
|
|
|
# cryptsetup luksOpen /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d crypted
|
|
Enter passphrase for /dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d: ***
|
|
|
|
# mkfs.ext4 /dev/mapper/crypted
|
|
</screen>
|
|
|
|
To ensure that this file system is automatically mounted at boot time
|
|
as <filename>/</filename>, add the following to
|
|
<filename>configuration.nix</filename>:
|
|
|
|
<programlisting>
|
|
boot.initrd.luks.devices.crypted.device = "/dev/disk/by-uuid/3f6b0024-3a44-4fde-a43a-767b872abe5d";
|
|
fileSystems."/".device = "/dev/mapper/crypted";
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|