Alex
May 13, 2018, 5:17am
1
I’ve been using proxmox for a long time, and I only need LXC. I have played around with LXD regularly for years and really want to use it instead.
But my problem is that all the servers only has two drives each, and I think I would like to continue using ZFS.
Sadly the Ubuntu server 18.04 installer does not support ZFS.
What would you guys recommend I do?
simos
(Simos Xenitellis)
May 13, 2018, 7:18am
2
You would install Ubuntu on ext4 as normal.
In another partition you would format as ZFS and keep there the containers. In fact, you can keep the partition unformatted and lxd init
will format for you.
1 Like
Alex
May 13, 2018, 8:16am
3
Do you know if there is any downsides to doing it that way?
simos
(Simos Xenitellis)
May 13, 2018, 5:57pm
4
There are no downsides that I can think of.
It is feasible to install Ubuntu 18.04 with the root filesystem on ZFS,
https://github.com/zfsonlinux/zfs/wiki/Ubuntu-18.04-Root-on-ZFS
However, the process is quite involved and it has not been implemented in the Ubuntu installer yet.
In terms of what LXD would prefer to have, that would be any of the good supported filesystems from the list, https://lxd.readthedocs.io/en/stable-2.0/storage-backends/
It’s just the storage of the container that has to be in a suitable filesystem.
Alex
May 14, 2018, 4:38pm
5
I ended up with the following:
Created two partitions on each drive and then set up an md raid 1.
Installed zfsutils and created a pool consisting of one partition from each drive and used the drive id when doing so.
Used lxd init and specified the pool.
Happiness!
Reboot.
Pool is gone…sadness
Steps:
zpool create -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD rpool mirror /dev/disk/by-id/ata-WDCThis text will be hidden_WD10EARS-22Y5B1_WD-WCAV5H111111-part2 /dev/disk/by-id/ata-WDC_WD10EARS-22Y5B1_WD-WCAV5H222222-part2
I then set up LXD to use the pool, created a container and started using it.
root@zfstest:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 423M 806G 96K none
rpool/containers 10.8M 806G 96K none
rpool/containers/c1 10.8M 806G 411M /var/lib/lxd/storage-pools/default/containers/c1
rpool/custom 96K 806G 96K none
rpool/deleted 96K 806G 96K none
rpool/images 411M 806G 96K none
rpool/images/b36ec647e374da4816104a98807633a2cc387488083d3776557081c4d0333618 411M 806G 411M none
rpool/snapshots 96K 806G 96K none
Then I rebooted and got this:
root@zfstest:~# zfs list
no datasets available
root@zfstest:~# zpool list
no pools available
Does anyone know why the pool disappears?
stgraber
(Stéphane Graber)
May 14, 2018, 8:47pm
6
Does zpool import rpool
get it back online?
ZFS is supposed to cache the list of pools and re-import them automatically on reboot…
idef1x
(Idef1x)
May 15, 2018, 11:01am
7
I “normally” always do a zpool export and zpool import just after creating the pool. Just to be sure the cache file is updated. So far it always worked for me
Alex
May 15, 2018, 6:47pm
8
Turns out that the partitions I created and used for ZFS was extended partitions when I should have used primary partitions.
The pool disappeared after a reboot and could not be imported using zpool import rpool
when using extended partitions.
It took me forever to figure out, but it seems to work perfectly now that I switched to primary partitions.
danboid
(Dan Mac Donald)
February 5, 2019, 6:41pm
9
It is easy to install Ubuntu to ZFS root if you have a MAAS server setup:
With recent updates to MAAS and Curtin, deploying Ubuntu with a ZFS root disk is now possible! Curtin added zfsroot support earlier this year and MAAS has now exposed the option. However, Ubuntu root on ZFS with MAAS is experimental! We…