ZFS on HDD
This commit is contained in:
parent
c397c5817b
commit
1d2c31a15a
4 changed files with 183 additions and 0 deletions
67
docs/helios64/install/docker-zfs.md
Normal file
67
docs/helios64/install/docker-zfs.md
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
# Docker with ZFS pool
|
||||||
|
|
||||||
|
When you already have working ZFS pool (see [here](/helios64/install/zfs)) and want to use Docker - it is good idea to use them togeter.
|
||||||
|
|
||||||
|
## **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-user
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
47
docs/helios64/install/lxd-zfs.md
Normal file
47
docs/helios64/install/lxd-zfs.md
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# LXD with ZFS pool
|
||||||
|
|
||||||
|
When you already have working ZFS pool (see [here](/helios64/install/zfs)) and want to use LXD - it is good idea to use them togeter.
|
||||||
|
|
||||||
|
## **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-user
|
||||||
|
```
|
||||||
|
|
||||||
|
## **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
|
||||||
|
```
|
66
docs/helios64/install/zfs.md
Normal file
66
docs/helios64/install/zfs.md
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
# ZFS on HDD
|
||||||
|
|
||||||
|
So you already installed the system on eMMC or SD? You might want to use ZFS on the hard disk(s)!
|
||||||
|
|
||||||
|
Note: This wiki does not cover root-on-zfs. (Althrough it should be also possible.) We assume rootfs is already on eMMC (or SD) and you want to keep your data on HDDs in ZFS pool.
|
||||||
|
|
||||||
|
Important: *Focal* is required. Do not use Buster.
|
||||||
|
|
||||||
|
## **Step 1** - Install Focal on eMMC
|
||||||
|
|
||||||
|
See necessary steps [here](/helios64/install/transfer).
|
||||||
|
|
||||||
|
## **Step 2** - Install ZFS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo armbian-config
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to Software and install headers.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install zfs-dkms zfsutils-linux
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
```bash
|
||||||
|
sudo apt install zfs-auto-snapshot
|
||||||
|
```
|
||||||
|
|
||||||
|
Reboot.
|
||||||
|
|
||||||
|
## **Step 3** - 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 4** - 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 5** - 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.
|
||||||
|
|
|
@ -81,6 +81,9 @@ nav:
|
||||||
- SDcard Install : 'helios64/install/sdcard.md'
|
- SDcard Install : 'helios64/install/sdcard.md'
|
||||||
- First Start : 'helios64/install/first-start.md'
|
- First Start : 'helios64/install/first-start.md'
|
||||||
- Transfer Installed OS: 'helios64/install/transfer.md'
|
- Transfer Installed OS: 'helios64/install/transfer.md'
|
||||||
|
- ZFS on HDD: 'helios64/install/zfs.md'
|
||||||
|
- Docker with ZFS: 'helios64/install/docker-zfs.md'
|
||||||
|
- LXD with ZFS: 'helios64/install/lxd-zfs.md'
|
||||||
- Recovery :
|
- Recovery :
|
||||||
- Recovery Mode: '/helios64/button/#recovery-button'
|
- Recovery Mode: '/helios64/button/#recovery-button'
|
||||||
- Maskrom Mode: 'helios64/maskrom.md'
|
- Maskrom Mode: 'helios64/maskrom.md'
|
||||||
|
|
Loading…
Add table
Reference in a new issue