CephFS - cephfs
¶
Ceph is an open-source storage platform that stores its data in a storage cluster based on RADOS. It is highly scalable and, as a distributed system without a single point of failure, very reliable.
Tip
If you want to quickly set up a basic Ceph cluster, check out MicroCeph.
Ceph provides different components for block storage and for file systems.
CephFS is Ceph’s file system component that provides a robust, fully-featured POSIX-compliant distributed file system. Internally, it maps files to Ceph objects and stores file metadata (for example, file ownership, directory paths, access permissions) in a separate data pool.
Terminology¶
Ceph uses the term object for the data that it stores. The daemon that is responsible for storing and managing data is the Ceph OSD. Ceph’s storage is divided into pools, which are logical partitions for storing objects. They are also referred to as data pools, storage pools or OSD pools.
A CephFS file system consists of two OSD storage pools, one for the actual data and one for the file metadata.
cephfs
driver in LXD¶
Note
The cephfs
driver can only be used for custom storage volumes with content type filesystem
.
For other storage volumes, use the Ceph driver.
That driver can also be used for custom storage volumes with content type filesystem
, but it implements them through Ceph RBD images.
Unlike other storage drivers, this driver does not set up the storage system but assumes that you already have a Ceph cluster installed.
You can either create the CephFS file system that you want to use beforehand and specify it through the source
option, or specify the cephfs.create_missing
option to automatically create the file system and the data and metadata OSD pools (with the names given in cephfs.data_pool
and cephfs.meta_pool
).
This driver also behaves differently than other drivers in that it provides remote storage. As a result and depending on the internal network, storage access might be a bit slower than for local storage. On the other hand, using remote storage has big advantages in a cluster setup, because all cluster members have access to the same storage pools with the exact same contents, without the need to synchronize storage pools.
LXD assumes that it has full control over the OSD storage pool. Therefore, you should never maintain any file system entities that are not owned by LXD in a LXD OSD storage pool, because LXD might delete them.
The cephfs
driver in LXD supports snapshots if snapshots are enabled on the server side.
Configuration options¶
The following configuration options are available for storage pools that use the cephfs
driver and for storage volumes in these pools.
Storage pool configuration¶
Key: | cephfs.cluster_name |
Type: | string |
Default: |
|
Scope: | global |
Key: | cephfs.create_missing |
Type: | bool |
Default: |
|
Scope: | global |
Use this option if the CephFS file system does not exist yet. LXD will then automatically create the file system and the missing data and metadata OSD pools.
Key: | cephfs.data_pool |
Type: | string |
Scope: | global |
This option specifies the name for the data OSD pool that should be used when creating a file system automatically.
Key: | cephfs.fscache |
Type: | bool |
Default: |
|
Scope: | global |
Key: | cephfs.meta_pool |
Type: | string |
Scope: | global |
This option specifies the name for the file metadata OSD pool that should be used when creating a file system automatically.
Key: | cephfs.osd_pg_num |
Type: | string |
Scope: | global |
This option specifies the number of OSD pool placement groups (pg_num
) to use
when creating a missing OSD pool.
Key: | cephfs.osd_pool_size |
Type: | string |
Default: |
|
This option specifies the number of OSD pool replicas to use when creating an OSD pool.
Key: | cephfs.path |
Type: | string |
Default: |
|
Scope: | global |
Key: | cephfs.user.name |
Type: | string |
Default: |
|
Scope: | global |
Key: | volatile.pool.pristine |
Type: | string |
Default: |
|
Scope: | global |
Tip
In addition to these configurations, you can also set default values for the storage volume configurations. See Configure default values for storage volumes.
Storage volume configuration¶
Key: | security.shifted |
Type: | bool |
Default: | same as |
Condition: | custom volume |
Scope: | global |
Enabling this option allows attaching the volume to multiple isolated instances.
Key: | security.unmapped |
Type: | bool |
Default: | same as |
Condition: | custom volume |
Scope: | global |
Key: | size |
Type: | string |
Default: | same as |
Condition: | appropriate driver |
Scope: | local |
Key: | snapshots.expiry |
Type: | string |
Default: | same as |
Condition: | custom volume |
Scope: | global |
Specify an expression like 1M 2H 3d 4w 5m 6y
.
Key: | snapshots.pattern |
Type: | string |
Default: | same as |
Condition: | custom volume |
Scope: | global |
You can specify a naming template that is used for scheduled snapshots and unnamed snapshots.
The snapshots.pattern
option takes a Pongo2 template string to format the snapshot name.
To add a time stamp to the snapshot name, use the Pongo2 context variable creation_date
.
Make sure to format the date in your template string to avoid forbidden characters in the snapshot name.
For example, set snapshots.pattern
to {{ creation_date|date:'2006-01-02_15-04-05' }}
to name the snapshots after their time of creation, down to the precision of a second.
Another way to avoid name collisions is to use the placeholder %d
in the pattern.
For the first snapshot, the placeholder is replaced with 0
.
For subsequent snapshots, the existing snapshot names are taken into account to find the highest number at the placeholder’s position.
This number is then incremented by one for the new name.
Key: | snapshots.schedule |
Type: | string |
Default: | same as |
Condition: | custom volume |
Scope: | global |
Specify either a cron expression (<minute> <hour> <dom> <month> <dow>
), a comma-separated list of schedule aliases (@hourly
, @daily
, @midnight
, @weekly
, @monthly
, @annually
, @yearly
), or leave empty to disable automatic snapshots (the default).