CephFS
CephFS (Ceph Filesystem) is a distributed file system that provides high-performance, scalable, and fault-tolerant file storage on top of a Ceph cluster. The cephfs tool allows for the management of a CephFS instance, and many operations are performed using Ceph administrative tools like ceph, mount, rados, and other filesystem tools. However, there are specific subcommands and operations associated with managing CephFS.
Below is a breakdown of cephfs-related subcommands and relevant operations for managing the Ceph filesystem:
General Structure of CephFS Commands
Using the ceph CLI to manage CephFS:
ceph CLI to manage CephFS:ceph fs <subcommand> [options]Common cephfs Subcommands
cephfs Subcommands1. Filesystem Management
ceph fs create
ceph fs createCreates a new Ceph filesystem (CephFS) instance.
ceph fs create <filesystem-name> <metadata-pool> <data-pool>Example:
ceph fs create myfs cephfs_metadata cephfs_data
This creates a new CephFS instance named myfs, with cephfs_metadata as the metadata pool and cephfs_data as the data pool.
ceph fs ls
ceph fs lsLists all the CephFS filesystems available in the Ceph cluster.
Example:
This lists all the filesystems configured in the Ceph cluster.
ceph fs rm
ceph fs rmRemoves a CephFS filesystem from the cluster.
Example:
This removes the filesystem myfs from the cluster (use with caution).
2. MDS (Metadata Server) Management
ceph fs status
ceph fs statusDisplays detailed status information about a CephFS instance, including MDS activity.
Example:
This shows the status of the filesystem myfs, including the MDS status and client connections.
ceph fs set
ceph fs setSets various configuration options for a specific CephFS filesystem.
Example:
This sets the maximum number of MDS daemons for the filesystem myfs to 2.
ceph fs dump
ceph fs dumpDumps the full configuration of a CephFS instance, including metadata pool, data pool, MDS settings, and placement groups.
Example:
This provides a detailed output of the configuration and status of the CephFS instances.
ceph fs mds fail
ceph fs mds failManually forces a failover of an MDS daemon to test failover functionality or to replace a non-responsive MDS.
Example:
This forces the failover of the MDS daemon with rank 0.
ceph fs mds stop
ceph fs mds stopStops a specific MDS daemon.
Example:
This stops the MDS daemon with rank 0.
3. Snapshot Management
ceph fs snap create
ceph fs snap createCreates a snapshot of a CephFS directory.
Example:
This creates a snapshot mysnap of the root directory / in the filesystem myfs.
ceph fs snap ls
ceph fs snap lsLists all snapshots for a specified CephFS directory.
Example:
This lists all snapshots in the root directory / of the myfs filesystem.
ceph fs snap rm
ceph fs snap rmRemoves a specific snapshot from a CephFS directory.
Example:
This removes the snapshot mysnap from the root directory / in the myfs filesystem.
4. Quota Management
ceph fs set-quota
ceph fs set-quotaSets a quota on a specified directory in a CephFS filesystem.
Example:
This sets a 100MB quota on the directory /mydir in the filesystem myfs.
ceph fs get-quota
ceph fs get-quotaRetrieves the current quota settings for a specified directory in a CephFS filesystem.
Example:
This retrieves the quota settings for the directory /mydir in the filesystem myfs.
5. Client Management
ceph fs authorize
ceph fs authorizeAuthorizes a Ceph client to access a specific CephFS filesystem with read, write, or full permissions.
Example:
This authorizes the client client.myclient to have read/write access to the myfs filesystem.
ceph fs deauthorize
ceph fs deauthorizeRevokes a Ceph client’s access to a specified filesystem.
Example:
This revokes the client client.myclient's access to the myfs filesystem.
6. Mounting a CephFS Filesystem
Mount via Kernel Client
You can mount a CephFS using the Linux kernel client.
Example:
This mounts the CephFS root / to the /mnt/mycephfs directory, using the admin keyring for authentication.
Mount via FUSE
You can also mount CephFS using the FUSE client.
Example:
This mounts the CephFS filesystem myfs to /mnt/mycephfs using the FUSE client.
7. Pool Management
ceph fs add_data_pool
ceph fs add_data_poolAdds a new data pool to an existing CephFS filesystem.
Example:
This adds a new data pool cephfs_data2 to the filesystem myfs.
ceph fs set default_pool
ceph fs set default_poolSets a pool as the default data or metadata pool for a CephFS filesystem.
Example:
This sets cephfs_data2 as the default data pool for the filesystem myfs.
Conclusion
CephFS offers rich functionality for managing distributed filesystems within a Ceph cluster. From creating filesystems and managing MDS daemons to handling quotas, snapshots, and client permissions, the ceph fs suite of commands provides the necessary tools to administer CephFS instances effectively. Additionally, CephFS integrates with Ceph’s powerful object store, making it a flexible solution for large-scale, high-performance storage environments
Last updated