About storage pools and storage volumes#
LXD supports creating and managing storage pools and storage volumes. The following storage drivers are supported:
Storage volume content types#
Storage volumes can be either filesystem
or block
type.
Containers and container images are always going to be using filesystem
.
Virtual machines and virtual machine images are always going to be using block
.
Custom storage volumes can be either types with the default being filesystem
.
Those custom storage volumes of type block
can only be attached to virtual machines.
Block custom storage volumes can be created with:
lxc storage volume create [<remote>]:<pool> <name> --type=block
Where to store LXD data#
Depending on the storage backends used, LXD can either share the filesystem with its host or keep its data separate.
Dedicated disk/partition#
In this mode, LXD’s storage will be completely independent from the host. This can be done by having LXD use an empty partition on your main disk or by having it use a full dedicated disk.
This is supported by all storage drivers except dir
, ceph
and cephfs
.
Loop disk#
If neither of the options above are possible for you, LXD can create a loop file on your main drive and then have the selected storage driver use that.
This is functionally similar to using a disk/partition but uses a large file on your main drive instead. This comes at a performance penalty as every writes need to go through the storage driver and then your main drive’s filesystem. The loop files also usually cannot be shrunk. They will grow up to the limit you select but deleting instances or images will not cause the file to shrink.
Default storage pool#
There is no concept of a default storage pool in LXD. Instead, the pool to use for the instance’s root is treated as just another “disk” device in LXD.
The device entry looks like:
root:
type: disk
path: /
pool: default
And it can be directly set on an instance (--storage
option to “lxc launch” and “lxc init”)
or it can be set through LXD profiles.
That latter option is what the default LXD setup (through “lxd init”) will do for you. The same can be done manually against any profile using (for the “default” profile):
lxc profile device add default root disk path=/ pool=default