]> git.proxmox.com Git - ceph.git/blob - ceph/doc/cephfs/fs-volumes.rst
dd38e38e419bb7e6e8818314b352976f70f7e881
[ceph.git] / ceph / doc / cephfs / fs-volumes.rst
1 .. _fs-volumes-and-subvolumes:
2
3 FS volumes and subvolumes
4 =========================
5
6 A single source of truth for CephFS exports is implemented in the volumes
7 module of the :term:`Ceph Manager` daemon (ceph-mgr). The OpenStack shared
8 file system service (manila_), Ceph Container Storage Interface (CSI_),
9 storage administrators among others can use the common CLI provided by the
10 ceph-mgr volumes module to manage the CephFS exports.
11
12 The ceph-mgr volumes module implements the following file system export
13 abstactions:
14
15 * FS volumes, an abstraction for CephFS file systems
16
17 * FS subvolumes, an abstraction for independent CephFS directory trees
18
19 * FS subvolume groups, an abstraction for a directory level higher than FS
20 subvolumes to effect policies (e.g., :doc:`/cephfs/file-layouts`) across a
21 set of subvolumes
22
23 Some possible use-cases for the export abstractions:
24
25 * FS subvolumes used as manila shares or CSI volumes
26
27 * FS subvolume groups used as manila share groups
28
29 Requirements
30 ------------
31
32 * Nautilus (14.2.x) or a later version of Ceph
33
34 * Cephx client user (see :doc:`/rados/operations/user-management`) with
35 the following minimum capabilities::
36
37 mon 'allow r'
38 mgr 'allow rw'
39
40
41 FS Volumes
42 ----------
43
44 Create a volume using::
45
46 $ ceph fs volume create <vol_name> [<placement>]
47
48 This creates a CephFS file system and its data and metadata pools. It can also
49 try to create MDSes for the filesystem using the enabled ceph-mgr orchestrator
50 module (see :doc:`/mgr/orchestrator`), e.g. rook.
51
52 <vol_name> is the volume name (an arbitrary string), and
53
54 <placement> is an optional string signifying which hosts should have NFS Ganesha
55 daemon containers running on them and, optionally, the total number of NFS
56 Ganesha daemons the cluster (should you want to have more than one NFS Ganesha
57 daemon running per node). For example, the following placement string means
58 "deploy NFS Ganesha daemons on nodes host1 and host2 (one daemon per host):
59
60 "host1,host2"
61
62 and this placement specification says to deploy two NFS Ganesha daemons each
63 on nodes host1 and host2 (for a total of four NFS Ganesha daemons in the
64 cluster):
65
66 "4 host1,host2"
67
68 For more details on placement specification refer to the `orchestrator doc
69 <https://docs.ceph.com/docs/master/mgr/orchestrator/#placement-specification>`_
70 but keep in mind that specifying the placement via a YAML file is not supported.
71
72 Remove a volume using::
73
74 $ ceph fs volume rm <vol_name> [--yes-i-really-mean-it]
75
76 This removes a file system and its data and metadata pools. It also tries to
77 remove MDSes using the enabled ceph-mgr orchestrator module.
78
79 List volumes using::
80
81 $ ceph fs volume ls
82
83 FS Subvolume groups
84 -------------------
85
86 Create a subvolume group using::
87
88 $ ceph fs subvolumegroup create <vol_name> <group_name> [--pool_layout <data_pool_name>] [--uid <uid>] [--gid <gid>] [--mode <octal_mode>]
89
90 The command succeeds even if the subvolume group already exists.
91
92 When creating a subvolume group you can specify its data pool layout (see
93 :doc:`/cephfs/file-layouts`), uid, gid, and file mode in octal numerals. By default, the
94 subvolume group is created with an octal file mode '755', uid '0', gid '0' and data pool
95 layout of its parent directory.
96
97
98 Remove a subvolume group using::
99
100 $ ceph fs subvolumegroup rm <vol_name> <group_name> [--force]
101
102 The removal of a subvolume group fails if it is not empty or non-existent.
103 '--force' flag allows the non-existent subvolume group remove command to succeed.
104
105
106 Fetch the absolute path of a subvolume group using::
107
108 $ ceph fs subvolumegroup getpath <vol_name> <group_name>
109
110 List subvolume groups using::
111
112 $ ceph fs subvolumegroup ls <vol_name>
113
114 .. note:: Subvolume group snapshot feature is no longer supported in mainline CephFS (existing group
115 snapshots can still be listed and deleted)
116
117 Remove a snapshot of a subvolume group using::
118
119 $ ceph fs subvolumegroup snapshot rm <vol_name> <group_name> <snap_name> [--force]
120
121 Using the '--force' flag allows the command to succeed that would otherwise
122 fail if the snapshot did not exist.
123
124 List snapshots of a subvolume group using::
125
126 $ ceph fs subvolumegroup snapshot ls <vol_name> <group_name>
127
128
129 FS Subvolumes
130 -------------
131
132 Create a subvolume using::
133
134 $ ceph fs subvolume create <vol_name> <subvol_name> [--size <size_in_bytes>] [--group_name <subvol_group_name>] [--pool_layout <data_pool_name>] [--uid <uid>] [--gid <gid>] [--mode <octal_mode>] [--namespace-isolated]
135
136
137 The command succeeds even if the subvolume already exists.
138
139 When creating a subvolume you can specify its subvolume group, data pool layout,
140 uid, gid, file mode in octal numerals, and size in bytes. The size of the subvolume is
141 specified by setting a quota on it (see :doc:`/cephfs/quota`). The subvolume can be
142 created in a separate RADOS namespace by specifying --namespace-isolated option. By
143 default a subvolume is created within the default subvolume group, and with an octal file
144 mode '755', uid of its subvolume group, gid of its subvolume group, data pool layout of
145 its parent directory and no size limit.
146
147 Remove a subvolume using::
148
149 $ ceph fs subvolume rm <vol_name> <subvol_name> [--group_name <subvol_group_name>] [--force] [--retain-snapshots]
150
151
152 The command removes the subvolume and its contents. It does this in two steps.
153 First, it moves the subvolume to a trash folder, and then asynchronously purges
154 its contents.
155
156 The removal of a subvolume fails if it has snapshots, or is non-existent.
157 '--force' flag allows the non-existent subvolume remove command to succeed.
158
159 A subvolume can be removed retaining existing snapshots of the subvolume using the
160 '--retain-snapshots' option. If snapshots are retained, the subvolume is considered
161 empty for all operations not involving the retained snapshots.
162
163 .. note:: Snapshot retained subvolumes can be recreated using 'ceph fs subvolume create'
164
165 .. note:: Retained snapshots can be used as a clone source to recreate the subvolume, or clone to a newer subvolume.
166
167 Resize a subvolume using::
168
169 $ ceph fs subvolume resize <vol_name> <subvol_name> <new_size> [--group_name <subvol_group_name>] [--no_shrink]
170
171 The command resizes the subvolume quota using the size specified by 'new_size'.
172 '--no_shrink' flag prevents the subvolume to shrink below the current used size of the subvolume.
173
174 The subvolume can be resized to an infinite size by passing 'inf' or 'infinite' as the new_size.
175
176 Fetch the absolute path of a subvolume using::
177
178 $ ceph fs subvolume getpath <vol_name> <subvol_name> [--group_name <subvol_group_name>]
179
180 Fetch the metadata of a subvolume using::
181
182 $ ceph fs subvolume info <vol_name> <subvol_name> [--group_name <subvol_group_name>]
183
184 The output format is json and contains fields as follows.
185
186 * atime: access time of subvolume path in the format "YYYY-MM-DD HH:MM:SS"
187 * mtime: modification time of subvolume path in the format "YYYY-MM-DD HH:MM:SS"
188 * ctime: change time of subvolume path in the format "YYYY-MM-DD HH:MM:SS"
189 * uid: uid of subvolume path
190 * gid: gid of subvolume path
191 * mode: mode of subvolume path
192 * mon_addrs: list of monitor addresses
193 * bytes_pcent: quota used in percentage if quota is set, else displays "undefined"
194 * bytes_quota: quota size in bytes if quota is set, else displays "infinite"
195 * bytes_used: current used size of the subvolume in bytes
196 * created_at: time of creation of subvolume in the format "YYYY-MM-DD HH:MM:SS"
197 * data_pool: data pool the subvolume belongs to
198 * path: absolute path of a subvolume
199 * type: subvolume type indicating whether it's clone or subvolume
200 * pool_namespace: RADOS namespace of the subvolume
201 * features: features supported by the subvolume
202 * state: current state of the subvolume
203
204 If a subvolume has been removed retaining its snapshots, the output only contains fields as follows.
205
206 * type: subvolume type indicating whether it's clone or subvolume
207 * features: features supported by the subvolume
208 * state: current state of the subvolume
209
210 The subvolume "features" are based on the internal version of the subvolume and is a list containing
211 a subset of the following features,
212
213 * "snapshot-clone": supports cloning using a subvolumes snapshot as the source
214 * "snapshot-autoprotect": supports automatically protecting snapshots, that are active clone sources, from deletion
215 * "snapshot-retention": supports removing subvolume contents, retaining any existing snapshots
216
217 The subvolume "state" is based on the current state of the subvolume and contains one of the following values.
218
219 * "complete": subvolume is ready for all operations
220 * "snapshot-retained": subvolume is removed but its snapshots are retained
221
222 List subvolumes using::
223
224 $ ceph fs subvolume ls <vol_name> [--group_name <subvol_group_name>]
225
226 .. note:: subvolumes that are removed but have snapshots retained, are also listed.
227
228 Create a snapshot of a subvolume using::
229
230 $ ceph fs subvolume snapshot create <vol_name> <subvol_name> <snap_name> [--group_name <subvol_group_name>]
231
232
233 Remove a snapshot of a subvolume using::
234
235 $ ceph fs subvolume snapshot rm <vol_name> <subvol_name> <snap_name> [--group_name <subvol_group_name>] [--force]
236
237 Using the '--force' flag allows the command to succeed that would otherwise
238 fail if the snapshot did not exist.
239
240 .. note:: if the last snapshot within a snapshot retained subvolume is removed, the subvolume is also removed
241
242 List snapshots of a subvolume using::
243
244 $ ceph fs subvolume snapshot ls <vol_name> <subvol_name> [--group_name <subvol_group_name>]
245
246 Fetch the metadata of a snapshot using::
247
248 $ ceph fs subvolume snapshot info <vol_name> <subvol_name> <snap_name> [--group_name <subvol_group_name>]
249
250 The output format is json and contains fields as follows.
251
252 * created_at: time of creation of snapshot in the format "YYYY-MM-DD HH:MM:SS:ffffff"
253 * data_pool: data pool the snapshot belongs to
254 * has_pending_clones: "yes" if snapshot clone is in progress otherwise "no"
255 * size: snapshot size in bytes
256
257 Cloning Snapshots
258 -----------------
259
260 Subvolumes can be created by cloning subvolume snapshots. Cloning is an asynchronous operation involving copying
261 data from a snapshot to a subvolume. Due to this bulk copy nature, cloning is currently inefficient for very huge
262 data sets.
263
264 .. note:: Removing a snapshot (source subvolume) would fail if there are pending or in progress clone operations.
265
266 Protecting snapshots prior to cloning was a pre-requisite in the Nautilus release, and the commands to protect/unprotect
267 snapshots were introduced for this purpose. This pre-requisite, and hence the commands to protect/unprotect, is being
268 deprecated in mainline CephFS, and may be removed from a future release.
269
270 The commands being deprecated are::
271
272 $ ceph fs subvolume snapshot protect <vol_name> <subvol_name> <snap_name> [--group_name <subvol_group_name>]
273 $ ceph fs subvolume snapshot unprotect <vol_name> <subvol_name> <snap_name> [--group_name <subvol_group_name>]
274
275 .. note:: Using the above commands would not result in an error, but they serve no useful function.
276
277 .. note:: Use subvolume info command to fetch subvolume metadata regarding supported "features" to help decide if protect/unprotect of snapshots is required, based on the "snapshot-autoprotect" feature availability.
278
279 To initiate a clone operation use::
280
281 $ ceph fs subvolume snapshot clone <vol_name> <subvol_name> <snap_name> <target_subvol_name>
282
283 If a snapshot (source subvolume) is a part of non-default group, the group name needs to be specified as per::
284
285 $ ceph fs subvolume snapshot clone <vol_name> <subvol_name> <snap_name> <target_subvol_name> --group_name <subvol_group_name>
286
287 Cloned subvolumes can be a part of a different group than the source snapshot (by default, cloned subvolumes are created in default group). To clone to a particular group use::
288
289 $ ceph fs subvolume snapshot clone <vol_name> <subvol_name> <snap_name> <target_subvol_name> --target_group_name <subvol_group_name>
290
291 Similar to specifying a pool layout when creating a subvolume, pool layout can be specified when creating a cloned subvolume. To create a cloned subvolume with a specific pool layout use::
292
293 $ ceph fs subvolume snapshot clone <vol_name> <subvol_name> <snap_name> <target_subvol_name> --pool_layout <pool_layout>
294
295 Configure maximum number of concurrent clones. The default is set to 4::
296
297 $ ceph config set mgr mgr/volumes/max_concurrent_clones <value>
298
299 To check the status of a clone operation use::
300
301 $ ceph fs clone status <vol_name> <clone_name> [--group_name <group_name>]
302
303 A clone can be in one of the following states:
304
305 #. `pending` : Clone operation has not started
306 #. `in-progress` : Clone operation is in progress
307 #. `complete` : Clone operation has successfully finished
308 #. `failed` : Clone operation has failed
309
310 Sample output from an `in-progress` clone operation::
311
312 $ ceph fs subvolume snapshot clone cephfs subvol1 snap1 clone1
313 $ ceph fs clone status cephfs clone1
314 {
315 "status": {
316 "state": "in-progress",
317 "source": {
318 "volume": "cephfs",
319 "subvolume": "subvol1",
320 "snapshot": "snap1"
321 }
322 }
323 }
324
325 (NOTE: since `subvol1` is in default group, `source` section in `clone status` does not include group name)
326
327 .. note:: Cloned subvolumes are accessible only after the clone operation has successfully completed.
328
329 For a successful clone operation, `clone status` would look like so::
330
331 $ ceph fs clone status cephfs clone1
332 {
333 "status": {
334 "state": "complete"
335 }
336 }
337
338 or `failed` state when clone is unsuccessful.
339
340 On failure of a clone operation, the partial clone needs to be deleted and the clone operation needs to be retriggered.
341 To delete a partial clone use::
342
343 $ ceph fs subvolume rm <vol_name> <clone_name> [--group_name <group_name>] --force
344
345 .. note:: Cloning only synchronizes directories, regular files and symbolic links. Also, inode timestamps (access and
346 modification times) are synchronized upto seconds granularity.
347
348 An `in-progress` or a `pending` clone operation can be canceled. To cancel a clone operation use the `clone cancel` command::
349
350 $ ceph fs clone cancel <vol_name> <clone_name> [--group_name <group_name>]
351
352 On successful cancelation, the cloned subvolume is moved to `canceled` state::
353
354 $ ceph fs subvolume snapshot clone cephfs subvol1 snap1 clone1
355 $ ceph fs clone cancel cephfs clone1
356 $ ceph fs clone status cephfs clone1
357 {
358 "status": {
359 "state": "canceled",
360 "source": {
361 "volume": "cephfs",
362 "subvolume": "subvol1",
363 "snapshot": "snap1"
364 }
365 }
366 }
367
368 .. note:: The canceled cloned can be deleted by using --force option in `fs subvolume rm` command.
369
370 .. _manila: https://github.com/openstack/manila
371 .. _CSI: https://github.com/ceph/ceph-csi