Focal / root on eMMC / ZFS on hdd / LXD / Docker
I received my Helios64 yesterday, installed the system, and decided to write down my steps before I forget them. Maybe someone will be interested. :-)
Preparation:
Assembly your box as described here.
Download Armbian Focal image from here and flash it to SD card. You may use Ether.
Insert the SD card to your Helios64 and boot.
After 15-20s the box should be accessible via ssh. (Of course you have to find out it's IP address somehow. For example check your router logs or use this.)
First login:
ssh root@IP
Password: 1234
After prompt - change password and create your daily user. You should never login as root again. Just use sudo in the future. :-)
Note: The auto-generated user is member of "disk" group. I do not like it. You may remove it so: "gpasswd -d user disk".
Now move your system to eMMC:
apt update
apt upgrade
armbian-config
# Go to: System -> Install -> Install to/update boot loader -> Install/Update the bootloader on SD/eMMC -> Boot from eMMC / system on eMMC
You can choose root filesystem. I have chosen ext4. Possibly f2fs might be a better idea, but I have not tested it.
When finished - power off, eject the sd card, power on.
Your system should now boot from eMMC.
If you want to change network configuration (for example set static IP) use this: "sudo nmtui".
You should also change the hostname:
sudo armbian-config
# Go to: Personal -> Hostname
ZFS on hard disk:
sudo armbian-config
# Go to Software and install headers.
sudo apt install zfs-dkms zfsutils-linux
# Optional:
sudo apt install zfs-auto-snapshot
# reboot
Prepare necessary partitions - for example using fdisk or gdisk.
Create your zfs pool. More or less this way:
sudo zpool create -o ashift=12 -m /mypool -mypool mirror /dev/disk/by-partuuid/abc123 /dev/disk/by-partuuid/xyz789
Reboot and make sure the pool is imported automatically. (For example by typing "zpool status".)
You should now have working system with root on eMMC and ZFS pool on HDD.
Docker with ZFS:
Prepare the filesystem:
sudo zfs create -o mountpoint=/var/lib/docker mypool/docker-root
sudo zfs create -o mountpoint=/var/lib/docker/volumes mypool/docker-volumes
sudo chmod 700 /var/lib/docker/volumes
# Option: If you use zfs-auto-snapshot, you might want to consider this:
sudo zfs set com.sun:auto-snapshot=false mypool/docker-root
sudo zfs set com.sun:auto-snapshot=true mypool/docker-volumes
Create /etc/docker/daemon.json with the following content:
{
"storage-driver": "zfs"
}
Add /etc/apt/sources.list.d/docker.list with the following content:
deb [arch=arm64] https://download.docker.com/linux/ubuntu focal stable
# deb-src [arch=arm64] https://download.docker.com/linux/ubuntu focal stable
Install Docker:
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
#You might want this:
sudo usermod -aG docker your-user
Voila! Your Docker should be ready! Test it: "docker run hello-world".
Option: Install Portainer:
sudo zfs create rpool/docker-volumes/portainer_data
# You might omit the above line if you do not want to have separate dataset for the docker volume (bad idea).
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Go to http://yourip:9000 and configure.
LXD with ZFS:
sudo zfs create -o mountpoint=none mypool/lxd-pool
sudo apt install lxd
sudo lxc init
# Configure ZFS this way:
Do you want to configure a new storage pool (yes/no) [default=yes]? yes
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, btrfs, ceph, lvm, zfs) [default=zfs]: zfs
Create a new ZFS pool (yes/no) [default=yes]? no
Name of the existing ZFS pool or dataset: mypool/lxd-pool
[...]
#You might want this:
sudo usermod -aG lxd your-user
# Option: If you use zfs-auto-snapshot, you might want to consider this:
sudo zfs set com.sun:auto-snapshot=false mypool/lxd-pool
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/containers
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/custom
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/virtual-machines
That's it. Lxd should work now on ZFS. :-)