ZFS install instructions (#37)

* ZFS install (for Focal)
* ZFS with Docker and LXD

Co-authored-by: Gauthier Provost <gauthier@kobol.io>
This commit is contained in:
michabbs 2020-12-23 09:17:19 +01:00 committed by GitHub
parent c397c5817b
commit f6be701131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 201 additions and 0 deletions

View file

@ -0,0 +1,71 @@
When you already have a working ZFS pool (see [here](/helios64/software/zfs/install-zfs/)) and want to use Docker - it is good idea to configure them together.
## **Step 1** - Prepare filesystem
```bash
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
```
Optional: If you use zfs-auto-snapshot, you might want to consider this:
```bash
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:
```bash
{
"storage-driver": "zfs"
}
```
## **Step 2** - Install Docker
Add `/etc/apt/sources.list.d/docker.list` with the following content:
```bash
deb [arch=arm64] https://download.docker.com/linux/ubuntu focal stable
# deb-src [arch=arm64] https://download.docker.com/linux/ubuntu focal stable
```
Proceed with installation:
```bash
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:
```bash
sudo usermod -aG docker <your-username>
```
Voila! Your Docker should be ready! Test it:
```bash
docker run hello-world
```
## **Step 3** - Optional: Install Portainer
```bash
sudo zfs create mypool/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.
------------
*Page contributed by [michabbs](https://github.com/michabbs)*
*Reference [Armbian Forum Dicussion](https://forum.armbian.com/topic/16559-tutorial-first-steps-with-helios64-zfs-install-config/)*

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -0,0 +1,74 @@
!!! Important
This install procedure only works with *Armbian Focal* for now. Instructions for *Armbian Buster* to be added soon.
So you already installed the system on eMMC or SD? You might want to use ZFS on the hard disk(s)! We assume rootfs is already on eMMC (or microSD Card) and you want to store your data on HDDs in ZFS pool.
!!! Note
This wiki does not cover root-on-zfs. (Although it should be also possible.)
## **Step 1** - Install ZFS
```bash
sudo armbian-config
```
Go to *Software* and install headers.
![Kernel Headers](/helios64/software/zfs/img/install-headers.png)
Once kernel headers installed, install ZFS with the following command:
```bash
sudo apt install zfs-dkms zfsutils-linux
```
Optional:
```bash
sudo apt install zfs-auto-snapshot
```
Reboot.
## **Step 2** - Prepare partitions
Use `fdisk` of `gdisk` to create necessary partitions on your hard drive. This is beyond scope of this wiki.
When ready look for assigned uuids:
```bash
ls -l /dev/disk/by-partuuid/
```
## **Step 3** - Create ZFS pool
```bash
sudo zpool create -o ashift=12 -m /mypool mypool mirror /dev/disk/by-partuuid/abc123 /dev/disk/by-partuuid/xyz789
sudo zfs set atime=off mypool
sudo zfs set compression=on mypool
```
Of course you may use more disks and create raidz instead of mirror. Your choice. :-)
Note: Do not use `/dev/sdXY` names. Use uuids only. This way your system will still work when you remove a disk or change order of disks.
If your disks are SSDs, enable trim support:
```bash
sudo zpool set autotrim=on mypool
```
## **Step 4** - Reboot
After reboot make sure the pool was imported automatically:
```bash
zpool status
```
You should now have working system with root on eMMC and ZFS pool on HDD.
------------
*Page contributed by [michabbs](https://github.com/michabbs)*
*Reference [Armbian Forum Dicussion](https://forum.armbian.com/topic/16559-tutorial-first-steps-with-helios64-zfs-install-config/)*

View file

@ -0,0 +1,51 @@
When you already have a working ZFS pool (see [here](/helios64/software/zfs/install-zfs/)) and want to use LXD - it is good idea to configure them together.
## **Step 1** - Prepare filesystem
```bash
sudo zfs create -o mountpoint=none mypool/lxd-pool
```
## **Step 2** - Install LXD
```bash
sudo apt install lxd
```
You might want this:
```bash
sudo usermod -aG lxd <your-username>
```
## **Step 3** - Configure LXD
```bash
sudo lxc init
```
Configure ZFS this way:
```bash
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
[...]
```
## **Step 4** - Optional
If you use zfs-auto-snapshot, you might want to consider this:
```bash
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
```
------------
*Page contributed by [michabbs](https://github.com/michabbs)*
*Reference [Armbian Forum Dicussion](https://forum.armbian.com/topic/16559-tutorial-first-steps-with-helios64-zfs-install-config/)*

View file

@ -84,6 +84,11 @@ nav:
- Recovery : - Recovery :
- Recovery Mode: '/helios64/button/#recovery-button' - Recovery Mode: '/helios64/button/#recovery-button'
- Maskrom Mode: 'helios64/maskrom.md' - Maskrom Mode: 'helios64/maskrom.md'
- Software:
- ZFS:
- Install ZFS: 'helios64/software/zfs/install-zfs.md'
- Docker with ZFS: 'helios64/software/zfs/docker-zfs.md'
- LXD with ZFS: 'helios64/software/zfs/lxd-zfs.md'
- Hardware: - Hardware:
- Overview: 'helios64/hardware.md' - Overview: 'helios64/hardware.md'
- Button: 'helios64/button.md' - Button: 'helios64/button.md'