<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ngortheone</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ngortheone"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Ngortheone"/>
	<updated>2026-04-30T07:02:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Setting_up_ZFS_with_native_encryption&amp;diff=16791</id>
		<title>Talk:Setting up ZFS with native encryption</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Setting_up_ZFS_with_native_encryption&amp;diff=16791"/>
		<updated>2020-01-18T20:17:51Z</updated>

		<summary type="html">&lt;p&gt;Ngortheone: Ngortheone moved page Talk:Setting up ZFS with native encryption to Talk:Alpine Linux with root on ZFS with native encryption: Better reflects intent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Talk:Alpine Linux with root on ZFS with native encryption]]&lt;/div&gt;</summary>
		<author><name>Ngortheone</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Root_on_ZFS_with_native_encryption&amp;diff=16790</id>
		<title>Talk:Root on ZFS with native encryption</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Root_on_ZFS_with_native_encryption&amp;diff=16790"/>
		<updated>2020-01-18T20:17:51Z</updated>

		<summary type="html">&lt;p&gt;Ngortheone: Ngortheone moved page Talk:Setting up ZFS with native encryption to Talk:Alpine Linux with root on ZFS with native encryption: Better reflects intent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Alpine on ZFS root issues in wiki procedure (v1) =&lt;br /&gt;
&lt;br /&gt;
I made some notes on issues I have encountered while following this guide. I will check these more and see if I can update the wiki with the notes.&lt;br /&gt;
&lt;br /&gt;
You can find the notes here: [https://pastebin.com/7jXtG6pT Notes on pastebin]&lt;br /&gt;
&lt;br /&gt;
~~&lt;/div&gt;</summary>
		<author><name>Ngortheone</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_ZFS_with_native_encryption&amp;diff=16789</id>
		<title>Setting up ZFS with native encryption</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_ZFS_with_native_encryption&amp;diff=16789"/>
		<updated>2020-01-18T20:17:51Z</updated>

		<summary type="html">&lt;p&gt;Ngortheone: Ngortheone moved page Setting up ZFS with native encryption to Alpine Linux with root on ZFS with native encryption: Better reflects intent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Alpine Linux with root on ZFS with native encryption]]&lt;/div&gt;</summary>
		<author><name>Ngortheone</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Root_on_ZFS_with_native_encryption&amp;diff=16788</id>
		<title>Root on ZFS with native encryption</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Root_on_ZFS_with_native_encryption&amp;diff=16788"/>
		<updated>2020-01-18T20:17:51Z</updated>

		<summary type="html">&lt;p&gt;Ngortheone: Ngortheone moved page Setting up ZFS with native encryption to Alpine Linux with root on ZFS with native encryption: Better reflects intent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
This documentation describes how to set up Alpine Linux using ZFS with a pool that uses ZFS&#039; native encryption capabilities, which have been recently introduced in ZFS on Linux (ZoL) 0.8.0.&lt;br /&gt;
&lt;br /&gt;
Note that you must install the &amp;lt;code&amp;gt;/boot/&amp;lt;/code&amp;gt; directory on an unencrypted partition (either an unencrypted ZFS pool or any other FS of your choosing, if it&#039;s compatible with your bootloader) to boot correctly.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need a medium to put a live image on. You can use any live medium that supports ZoL &amp;gt;=0.8.x, but as of writing this it&#039;s easiest to use [https://ubuntu.com/download/desktop Ubuntu 19.10], which comes with ZFS pre-installed.&lt;br /&gt;
&lt;br /&gt;
== Hard Disk Device Name ==&lt;br /&gt;
&lt;br /&gt;
The following documentation uses the &amp;lt;code&amp;gt;/dev/sda&amp;lt;/code&amp;gt; device as installation destination. If your environment uses a different device name for your hard disk, use the corresponding device names in the examples. It also uses &amp;lt;code&amp;gt;rpool&amp;lt;/code&amp;gt; as name of the root pool, you can change this at will, but be sure to change it everywhere it&#039;s mentioned.&lt;br /&gt;
&lt;br /&gt;
= Setting up Alpine Linux Using ZFS with native encryption =&lt;br /&gt;
&lt;br /&gt;
To install Alpine Linux in a ZFS pool with encryption enable, you cannot use the [[Installation|official installation]] procedure, so follow along this guide.&lt;br /&gt;
&lt;br /&gt;
== Creating the Partition Layout ==&lt;br /&gt;
&lt;br /&gt;
Linux requires an unencrypted &amp;lt;code&amp;gt;/boot/&amp;lt;/code&amp;gt; partition to boot. You can assign the remaining space for the encrypted ZFS pool.&lt;br /&gt;
&lt;br /&gt;
* Start the &amp;lt;code&amp;gt;fdisk&amp;lt;/code&amp;gt; utility to set up partitions:&lt;br /&gt;
&lt;br /&gt;
 # fdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
:* Create the &amp;lt;code&amp;gt;/boot/&amp;lt;/code&amp;gt; partition:&lt;br /&gt;
::* Enter &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;100m&amp;lt;/code&amp;gt; to create a new 100 MB primary partition.&lt;br /&gt;
&lt;br /&gt;
:* Set the &amp;lt;code&amp;gt;/boot/&amp;lt;/code&amp;gt; partition active:&lt;br /&gt;
::* Enter &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* Create the ZFS partition:&lt;br /&gt;
::* Enter &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; to start creating the next partition. Press &amp;lt;code&amp;gt;Enter&amp;lt;/code&amp;gt; to select the default start cylinder. Enter the size of partition. For example, &amp;lt;code&amp;gt;512m&amp;lt;/code&amp;gt; for 512 MB or &amp;lt;code&amp;gt;5g&amp;lt;/code&amp;gt; for 5 GB. Alternatively press &amp;lt;code&amp;gt;Enter&amp;lt;/code&amp;gt; to set the maximum available size.&lt;br /&gt;
&lt;br /&gt;
:* To verify the settings, press &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;. The output shows, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Device     Boot  Start      End  Sectors  Size Id Type&lt;br /&gt;
/dev/sda1  *      2048   206847   204800  100M 83 Linux&lt;br /&gt;
/dev/sda2       206848 41943039 41736192 19.9G 83 Linux&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Press &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; to save the changes.&lt;br /&gt;
&lt;br /&gt;
== Setting up the root pool ==&lt;br /&gt;
&lt;br /&gt;
You can create your rootpool with the following command:&lt;br /&gt;
&lt;br /&gt;
 # zpool create -o ashift=12 \&lt;br /&gt;
      -O acltype=posixacl -O canmount=off -O compression=lz4 \&lt;br /&gt;
      -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa \&lt;br /&gt;
      -O encryption=aes-256-gcm -O keylocation=prompt -O keyformat=passphrase \&lt;br /&gt;
      -O mountpoint=/ -R /mnt \&lt;br /&gt;
      rpool /dev/sda2&lt;br /&gt;
&lt;br /&gt;
You will have to enter your passphrase at this point. Choose wisely, as your passphrase is most likely [https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions#5-security-aspects the weakest link in this setup].&lt;br /&gt;
&lt;br /&gt;
A few notes on the options supplied to zpool:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ashift=12&amp;lt;/code&amp;gt; is recommended here because many drives today have 4KiB (or larger) physical sectors, even though they present 512B logical sectors&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;acltype=posixacl&amp;lt;/code&amp;gt; enables POSIX ACLs globally&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;normalization=formD&amp;lt;/code&amp;gt; eliminates some corner cases relating to UTF-8 filename normalization. It also enables &amp;lt;code&amp;gt;utf8only=on&amp;lt;/code&amp;gt;, meaning that only files with valid UTF-8 filenames will be accepted.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;xattr=sa&amp;lt;/code&amp;gt; vastly improves the performance of extended attributes, but is Linux-only. If you care about using this pool on other OpenZFS implementation don&#039;t specify this option.&lt;br /&gt;
&lt;br /&gt;
After completing this, confirm that the pool has been created:&lt;br /&gt;
&lt;br /&gt;
 # zpool status&lt;br /&gt;
&lt;br /&gt;
Should return something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  pool: rpool&lt;br /&gt;
 state: ONLINE&lt;br /&gt;
  scan: none requested&lt;br /&gt;
config:&lt;br /&gt;
&lt;br /&gt;
	NAME         STATE     READ WRITE CKSUM&lt;br /&gt;
	rpool       ONLINE       0     0     0&lt;br /&gt;
	  sda2  ONLINE       0     0     0&lt;br /&gt;
&lt;br /&gt;
errors: No known data errors&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating the required datasets ===&lt;br /&gt;
&lt;br /&gt;
 # zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # zfs create -o mountpoint=legacy rpool/ROOT/alpine&lt;br /&gt;
 # mount -t zfs rpool/ROOT/alpine /mnt/&lt;br /&gt;
&lt;br /&gt;
=== Creating optional datasets (feel free to add your own) ===&lt;br /&gt;
&lt;br /&gt;
 # zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
 # zfs create -o mountpoint=/var/log rpool/LOG&lt;br /&gt;
&lt;br /&gt;
== Creating the &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; filesystem ==&lt;br /&gt;
&lt;br /&gt;
 # mkfs.ext4 /dev/sda1&lt;br /&gt;
&lt;br /&gt;
== Mounting the &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; filesystem ==&lt;br /&gt;
&lt;br /&gt;
* Create the &amp;lt;code&amp;gt;/mnt/boot/&amp;lt;/code&amp;gt; directory and mount the &amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt; partition in this directory:&lt;br /&gt;
&lt;br /&gt;
 # mkdir /mnt/boot/&lt;br /&gt;
 # mount -t ext4 /dev/sda1 /mnt/boot/&lt;br /&gt;
&lt;br /&gt;
== Installing Alpine Linux ==&lt;br /&gt;
&lt;br /&gt;
Please follow [[Installing_Alpine_Linux_in_a_chroot|Installing Alpine Linux in a chroot]] to setup a base install of Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve followed that guide, you still have to do some additional setup for ZFS:&lt;br /&gt;
&lt;br /&gt;
* As of the time of writing this ZFS 0.8.x is only available in [[Edge]], so you&#039;ll have to enable it in &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt;. Check [https://pkgs.alpinelinux.org/packages?name=zfs pkgs.alpinelinux.org] to see the status of this.&lt;br /&gt;
&lt;br /&gt;
* Install the ZoL and linux-vanilla package: &amp;lt;code&amp;gt;apk add linux-vanilla zfs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enable ZFS&#039; services:&lt;br /&gt;
&lt;br /&gt;
 # rc-update add zfs-import sysinit&lt;br /&gt;
 # rc-update add zfs-mount sysinit&lt;br /&gt;
&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt;/etc/mkinitfs/mkinitfs.conf&amp;lt;/code&amp;gt; file and append &amp;lt;code&amp;gt;zfs&amp;lt;/code&amp;gt; module to the &amp;lt;code&amp;gt;features&amp;lt;/code&amp;gt; parameter:&lt;br /&gt;
&lt;br /&gt;
 features=&amp;quot;ata base ide scsi usb virtio ext4 lvm &amp;lt;u&amp;gt;zfs&amp;lt;/u&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Be mindful to also include other modules which may be required for your setup, such as the &amp;lt;code&amp;gt;nvme&amp;lt;/code&amp;gt; module.&lt;br /&gt;
&lt;br /&gt;
* Rebuild the initial RAM disk:&lt;br /&gt;
&lt;br /&gt;
 # mkinitfs $(ls /lib/modules/)&lt;br /&gt;
&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt;/etc/update-extlinux.conf&amp;lt;/code&amp;gt; file, set the root ZFS dataset and append the following kernel options to the &amp;lt;code&amp;gt;default_kernel_opts&amp;lt;/code&amp;gt; parameter:&lt;br /&gt;
&lt;br /&gt;
 root=rpool/ROOT/alpine&lt;br /&gt;
 default_kernel_opts=&amp;quot;... &amp;lt;u&amp;gt;rootfstype=zfs&amp;lt;/u&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Update extlinux&#039;s config (if you&#039;re not using a different bootloader)&lt;br /&gt;
&lt;br /&gt;
 # update-extlinux&lt;br /&gt;
 # exit&lt;br /&gt;
&lt;br /&gt;
: Ignore the errors the &amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt; utility displays.&lt;br /&gt;
&lt;br /&gt;
* Write the MBR to the &amp;lt;code&amp;gt;/dev/sda&amp;lt;/code&amp;gt; device:&lt;br /&gt;
&lt;br /&gt;
 # dd bs=440 count=1 conv=notrunc if=/mnt/usr/share/syslinux/mbr.bin of=/dev/sda&lt;br /&gt;
&lt;br /&gt;
== Unmounting the filesystems ==&lt;br /&gt;
&lt;br /&gt;
* Unmount &amp;lt;code&amp;gt;/mnt/boot/&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # umount /mnt/boot/&lt;br /&gt;
&lt;br /&gt;
* Unmount all zfs filesystems:&lt;br /&gt;
&lt;br /&gt;
 # zfs unmount -a&lt;br /&gt;
&lt;br /&gt;
* Reboot the system:&lt;br /&gt;
&lt;br /&gt;
 # reboot&lt;br /&gt;
&lt;br /&gt;
== Booting the system ==&lt;br /&gt;
&lt;br /&gt;
Right now mkinitfs doesn&#039;t support ZFS asking for passwords during boot, so it&#039;ll throw you into a rescue shell for you to enter the password during boot. You have to do the following things after pressing enter:&lt;br /&gt;
&lt;br /&gt;
 # zfs load-key -a&lt;br /&gt;
 # mount -t zfs rpool/ROOT/alpine /sysroot&lt;br /&gt;
 # exit&lt;br /&gt;
&lt;br /&gt;
And your system should continue booting! :)&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
== General Procedure ==&lt;br /&gt;
&lt;br /&gt;
In case your system fails to boot, you can verify the settings and fix incorrect configurations:&lt;br /&gt;
&lt;br /&gt;
* [[#Preparing_the_Installation_Environment|Preparing the Installation Environment]]&lt;br /&gt;
&lt;br /&gt;
* Load the ZFS kernel module:&lt;br /&gt;
&lt;br /&gt;
 # modprobe zfs&lt;br /&gt;
&lt;br /&gt;
* [[#Mounting_the_File_Systems|Mount the file systems]]&lt;br /&gt;
&lt;br /&gt;
 # zpool import -R /mnt rpool&lt;br /&gt;
 # mount -t ext4 /dev/sda1 /mnt/boot&lt;br /&gt;
&lt;br /&gt;
* Verify that you run the steps described in the [[#Installing_Alpine_Linux|Installing Alpine Linux]] section correctly. Update the configuration if necessary.&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Ngortheone</name></author>
	</entry>
</feed>