lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Support for ZVOL as storage driver

Open kattunga opened this issue 7 years ago • 5 comments

At this momment LXD support ZFS as storage driver but only as ZFS filesystem. It would be great to has support for ZVOL (zfs volumes) as storage driver working as LVM or CEPH. This let us, for example, to use XFS filesystem for a MongoDB container (XFS is a requirement for MongoDB) and get the beneficts of ZVOL's (snapshots, send/receive).

Regards

kattunga avatar Sep 29 '17 14:09 kattunga

Standard linux quotas support is also needed to be able to run things like Plesk, ISPmanager, ISPconfig and so on. It cannot be enabled on datasets but could be on zvol

loxK avatar Apr 01 '19 23:04 loxK

So we've made some progress on this thanks to the VM support. We have logic to create, snapshot, ... zvols on zfs. However this is currently only available for VM storage and there are no option to have containers use it as a backend with a filesystem setup on top.

This should be far easier to implement now than before though, albeit still not trivial.

stgraber avatar Feb 02 '20 21:02 stgraber

There is also good point to use ZVOL inside an LXC container, it is nested containerization with containerd/rkit for docker or even for K8S. As a workaround it is possible to use LVM on top of ZVOL as a storage for block devices (created manually on the host and pvcreate on top), but for dynamic control it is really needed to implement ZVOL support for volumes.

arren-ru avatar May 13 '20 15:05 arren-ru

What is the current state of this feature? Will support of zvol ever be added?

I suppose it will be possible to use user-level quotas inside lxd container with ext4 on zvol and a lot of users really want this feature.

knutov avatar May 11 '21 12:05 knutov

still staring at it , still not see any implementation or is it have some preview? now with k8s shift to containerd as main supported crio, but zfs still not perfectly supported for containerd , is that really necessary might i have to shift my host rootfs from zfs to ext4 or what?

afrojewelz avatar Jul 25 '22 07:07 afrojewelz

We now have an option on the zfs driver to store volumes on zvols.

stgraber avatar Feb 17 '23 22:02 stgraber

Hi, I tried to use this new option but I couldn't.

I have a lxd server with 2 storages:

The old one: with LVM controller (where I run all my non zfs compatible containers) The new one: with ZFS driver, zfs.block_mode = true

When I copy or move containers from LVM storage to ZFS storage, the zfs.block_mode flag is not honored and the containers are created on ZFS storage as a dataset. Also if I export containers from the LVM storage and I import them into ZFS storage they are created as dataset instead of zvols.

I understand that “existing instances using datasets will not be converted to zvols” when they are copied or moved between zfs storages, but why zfs.block_mode = true can’t be honored when storages use different drivers?

I found no way to migrate my db/docker containers (that are not compatible with zfs datasets) from LVM to ZFS, and create all of them from scratch is not an option, is there any solution?

I also found this function useless on clusters with different storage and different controllers, because if you mistakenly move a container configured with block mode to a non-zfs storage, you can never go back to zfs block mode.

Regards

kattunga avatar Mar 10 '23 14:03 kattunga

@monstermunchkin

stgraber avatar Mar 10 '23 14:03 stgraber

@kattunga as this issue is closed, I would hate for your post to get lost/forgotten about, would you mind opening a new issue here https://github.com/lxc/lxd/issues ?

Thanks

tomponline avatar Mar 15 '23 08:03 tomponline

I understand that “existing instances using datasets will not be converted to zvols” when they are copied or moved between zfs storages, but why zfs.block_mode = true can’t be honored when storages use different drivers?

You're right, we should find a way to detect this and apply the ZFS storage pool defaults to new volumes not coming from a ZFS pool.

tomponline avatar Mar 15 '23 08:03 tomponline

@kattunga as this issue is closed, I would hate for your post to get lost/forgotten about, would you mind opening a new issue here https://github.com/lxc/lxd/issues ?

Thanks

done, thank you.

issue #11471

kattunga avatar Mar 15 '23 15:03 kattunga