]> git.proxmox.com Git - ceph.git/blame - ceph/doc/man/8/rbdmap.rst
update sources to v12.1.2
[ceph.git] / ceph / doc / man / 8 / rbdmap.rst
CommitLineData
7c673cae
FG
1:orphan:
2
3=========================================
4 rbdmap -- map RBD devices at boot time
5=========================================
6
7.. program:: rbdmap
8
9Synopsis
10========
11
12| **rbdmap map**
13| **rbdmap unmap**
14
15
16Description
17===========
18
19**rbdmap** is a shell script that automates ``rbd map`` and ``rbd unmap``
20operations on one or more RBD (RADOS Block Device) images. While the script can be
21run manually by the system administrator at any time, the principal use case is
22automatic mapping/mounting of RBD images at boot time (and unmounting/unmapping
23at shutdown), as triggered by the init system (a systemd unit file,
24``rbdmap.service`` is included with the ceph-common package for this purpose).
25
26The script takes a single argument, which can be either "map" or "unmap".
27In either case, the script parses a configuration file (defaults to ``/etc/ceph/rbdmap``,
28but can be overridden via an environment variable ``RBDMAPFILE``). Each line
29of the configuration file corresponds to an RBD image which is to be mapped, or
30unmapped.
31
32The configuration file format is::
33
34 IMAGESPEC RBDOPTS
35
36where ``IMAGESPEC`` should be specified as ``POOLNAME/IMAGENAME`` (the pool
37name, a forward slash, and the image name), or merely ``IMAGENAME``, in which
38case the ``POOLNAME`` defaults to "rbd". ``RBDOPTS`` is an optional list of
39parameters to be passed to the underlying ``rbd map`` command. These parameters
40and their values should be specified as a comma-separated string::
41
42 PARAM1=VAL1,PARAM2=VAL2,...,PARAMN=VALN
43
44This will cause the script to issue an ``rbd map`` command like the following::
45
46 rbd map POOLNAME/IMAGENAME --PARAM1 VAL1 --PARAM2 VAL2
47
48(See the ``rbd`` manpage for a full list of possible options.)
49
50When run as ``rbdmap map``, the script parses the configuration file, and for
51each RBD image specified attempts to first map the image (using the ``rbd map``
52command) and, second, to mount the image.
53
54When run as ``rbdmap unmap``, images listed in the configuration file will
55be unmounted and unmapped.
56
57``rbdmap unmap-all`` attempts to unmount and subsequently unmap all currently
c07f9fc5 58mapped RBD images, regardless of whether or not they are listed in the
7c673cae
FG
59configuration file.
60
61If successful, the ``rbd map`` operation maps the image to a ``/dev/rbdX``
62device, at which point a udev rule is triggered to create a friendly device
63name symlink, ``/dev/rbd/POOLNAME/IMAGENAME``, pointing to the real mapped
64device.
65
66In order for mounting/unmounting to succeed, the friendly device name must
67have a corresponding entry in ``/etc/fstab``.
68
69When writing ``/etc/fstab`` entries for RBD images, it's a good idea to specify
70the "noauto" (or "nofail") mount option. This prevents the init system from
71trying to mount the device too early - before the device in question even
72exists. (Since ``rbdmap.service``
73executes a shell script, it is typically triggered quite late in the boot
74sequence.)
75
76
77Examples
78========
79
80Example ``/etc/ceph/rbdmap`` for two RBD images called "bar1" and "bar2", both
81in pool "foopool"::
82
83 foopool/bar1 id=admin,keyring=/etc/ceph/ceph.client.admin.keyring
84 foopool/bar2 id=admin,keyring=/etc/ceph/ceph.client.admin.keyring
85
86Each line in the file contains two strings: the image spec and the options to
87be passed to ``rbd map``. These two lines get transformed into the following
88commands::
89
90 rbd map foopool/bar1 --id admin --keyring /etc/ceph/ceph.client.admin.keyring
91 rbd map foopool/bar2 --id admin --keyring /etc/ceph/ceph.client.admin.keyring
92
93If the images had XFS filesystems on them, the corresponding ``/etc/fstab``
94entries might look like this::
95
96 /dev/rbd/foopool/bar1 /mnt/bar1 xfs noauto 0 0
97 /dev/rbd/foopool/bar2 /mnt/bar2 xfs noauto 0 0
98
99After creating the images and populating the ``/etc/ceph/rbdmap`` file, making
100the images get automatically mapped and mounted at boot is just a matter of
101enabling that unit::
102
103 systemctl enable rbdmap.service
104
105
106Options
107=======
108
109None
110
111
112Availability
113============
114
115**rbdmap** is part of Ceph, a massively scalable, open-source, distributed
116storage system. Please refer to the Ceph documentation at
117http://ceph.com/docs for more information.
118
119
120See also
121========
122
123:doc:`rbd <rbd>`\(8),