Suppose my container has 1 disk /dev/xvda but I want to add an additional disk (disk /dev/xvdb) to my container from zfs . Is it possible? How can I do it?
If you mount the block device’s filesystem on the host then you can share the directory into the container using:
lxc config device add <instance> mydisk source=/host/path path=/path/inside/container
I have created a filesystem “mystorage2” with lxd using a zfs pool named: lxdhosts:
lxc storage volume list lxdhosts | grep storage
| custom | mystorage2 | | filesystem | 0 |
$ zfs list | grep mystorage2
lxdhosts/custom/default_mystorage2 24K 954M 24K legacy
How can I attach this into a running remote container?
I can’t seem to get it right.
lxc config device add storage new-disk filesystem source=lxdhosts/custom/default_mystorage2 path=/foo
Error: Invalid devices: Device validation failed for "new-disk": Failed loading device "new-disk": Unsupported device type
erik@pixel:~ > lxc config device add storage new-disk filesystem source=/lxdhosts/custom/default_mystorage2 path=/foo
Error: Invalid devices: Device validation failed for "new-disk": Failed loading device "new-disk": Unsupported device type
erik@pixel:~ > lxc config device add storage new-disk filesystem source=/dev/lxdhosts/custom/default_mystorage2 path=/foo
Error: Invalid devices: Device validation failed for "new-disk": Failed loading device "new-disk": Unsupported device type
lxc config device add storage new-disk filesystem source=mystorage2 path=/foo
Error: Invalid devices: Device validation failed for "new-disk": Failed loading device "new-disk": Unsupported device type
[UPDATE]: I got it to work by adding “pool=lxdhosts” which isn’t well documented from the “–help”.
lxc config device add storage new-disk disk source=mystorage2 path=/opt/foo pool=lxdhosts
Device new-disk added to storage
Here you can see that nothing is in the “help”
lxc config device add storage new-disk disk source=mystorage2 path=/foo --help | grep pool
1 Like
1 Like