Example:
1. Imperative Method:
Create Cephfs volume/subvolume
# ceph fs volume create cephfs
# ceph fs subvolumegroup create cephfs smb
# ceph fs subvolume create cephfs sv1 --group-name=smb --mode=0777
# ceph fs subvolume create cephfs sv2 --group-name=smb --mode=0777
Enable SMB management Module
# ceph mgr module enable smb
Creating smb cluster/share
# ceph smb cluster create smb1 user --define-user-pass=user1%passwd
# ceph smb share create smb1 share1 cephfs / --subvolume=smb/sv1
Map a network drive from windows clients
2. Declarative Method
Create Cephfs volume/subvolume
# ceph fs volume create cephfs
# ceph fs subvolumegroup create cephfs smb
# ceph fs subvolume create cephfs sv1 --group-name=smb --mode=0777
# ceph fs subvolume create cephfs sv2 --group-name=smb --mode=0777
Enable SMB management Module
# ceph mgr module enable smb
Creating smb cluster/share
# ceph smb apply -i - <<'EOF'
# --- Begin Embedded YAML
- resource_type: ceph.smb.cluster
cluster_id: smb1
auth_mode: user
user_group_settings:
- {source_type: resource, ref: ug1}
placement:
count: 1
- resource_type: ceph.smb.usersgroups
users_groups_id: ug1
values:
users:
- {name: user1, password: passwd}
- {name: user2, password: passwd}
groups: []
- resource_type: ceph.smb.share
cluster_id: smb1
share_id: share1
cephfs:
volume: cephfs
subvolumegroup: smb
subvolume: sv1
path: /
- resource_type: ceph.smb.share
cluster_id: smb1
share_id: share2
cephfs:
volume: cephfs
subvolumegroup: smb
subvolume: sv2
path: /
# --- End Embedded YAML
Map a network drive from windows clients
Basic SMB mgr module cli command
Creating an SMB cluster
# ceph smb cluster create <cluster_id> {user} [--domain-realm=<domain_realm>]
[--domain-join-user-pass=<domain_join_user_pass>] [--define-user-pass=<define_user_pass>] [--custom-dns=<custom_dns>]
Example:
Auth_Mode:User
# ceph smb cluster create smb1 user --define_user_pass user1%passwd --placement label:smb --clustering default
Auth_Mode: AD
# ceph smb cluster create smb1 active-directory --domain_realm samba.qe --domain_join_user_pass Administrator%Redhat@123 --custom_dns 10.70.44.153 --placement label:smb --clustering default
Creating an SMB cluster with the declarative method
# ceph smb apply -i [--format <value>]
Example:
# ceph smb apply -i resources.yaml
Creating SMB share
# ceph smb share create <cluster_id> <share_id> <cephfs_volume> <path> [<share_name>] [<subvolume>] [--readonly] [--format]
Example:
# ceph smb share create smb1 share1 cephfs / --subvolume=smb/sv1
Listening a SMB Cluster
# ceph smb share ls <cluster_id> [--format <value>]
Example:
# ceph smb share ls smb1
Viewing SMB Cluster Details
# ceph smb show [<resource_names>]
Example:
# ceph smb show ceph.smb.cluster.smb1
Deleting SMB Share
# ceph smb share rm <cluster_id> <share_id>
Example:
# ceph smb share rm smb1 share1
Deleting SMB cluster
# ceph smb cluster rm <cluster_id>
Example:
# ceph smb share rm smb1
Conclusion
Ceph SMB MGR module in Ceph 8.0 brings an innovative and efficient way to manage SMB services within CephFS. Whether through imperative or declarative methods, users can easily create, manage, and control SMB clusters and shares. This integration simplifies the setup of Samba services, enhances scalability, and offers greater flexibility for administrators.With the ability to manage SMB access to CephFS seamlessly, users can now have a more streamlined process for providing secure and scalable file services.