Hi,
If I pass through a Zvol to a container as a unix-block device, should I be able to run fdisk in the container and format the drive?
I’m testing this and its not allowing me to run fdisk against the zvol that I see listed in lsblk?
I was hoping to run a ceph OSD inside lxd (inside rook kubernetes) but it seems to be failing when I try and bind a PVC. I’m not sure if this is to do with it not having full control of the block devices it finds, I assume it will try and format them but if I can’t do anything with fdisk, them I’m guessin kubernetes/rook will have the same problem?
Many thanks,
Jon.
Here is my config file
root@p68 ~ # lxc config show kube06
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 18.04 LTS amd64 (release) (20200129.1)
image.label: release
image.os: ubuntu
image.release: bionic
image.serial: "20200129.1"
image.type: squashfs
image.version: "18.04"
limits.memory: 6000MB
linux.kernel_modules: rbd,br_netfilter,ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,aufs
raw.lxc: "lxc.apparmor.profile=unconfined\nlxc.cap.drop= \nlxc.cgroup.devices.allow=a\nlxc.mount.auto=proc:rw
sys:rw"
security.nesting: "true"
security.privileged: "true"
volatile.base_image: 9e7158fc0683d41f7f692ce8b17598716d7eee925c6a593432df59488bf4131f
volatile.eth0.host_name: veth6311e4f1
volatile.eth0.hwaddr: 00:16:3e:3c:dd:87
volatile.eth0.name: eth0
volatile.idmap.base: "0"
volatile.idmap.current: '[]'
volatile.idmap.next: '[]'
volatile.last_state.idmap: '[]'
volatile.last_state.power: RUNNING
devices:
aadisable:
path: /sys/module/nf_conntrack/parameters/hashsize
source: /dev/null
type: disk
aadisable1:
path: /sys/module/apparmor/parameters/enabled
source: /dev/null
type: disk
disk3:
source: /dev/zd48p1
type: unix-block
disk4:
source: /dev/zvol/zfs1/zvol5
type: unix-block
disk5:
source: /dev/zvol/zfs1/zvol6
type: unix-block
eth0:
nictype: bridged
parent: lxdbr0
type: nic
kmsg:
path: /dev/kmsg
source: /dev/kmsg
type: unix-char
ephemeral: false
profiles:
- default
stateful: false
description: ""
Hopefully someone may find this helpful. Not sure if its the most elegent way of sorting it but I’ll post anyway:
The disks you want to pass in, you need to get the major:minor numbers displayed against them in lsblk
ran commands to make sure container user has access:

Snippet of resulting container config:
Cobbled this together after a few lucky visits to stackoverflow 