xref: /freebsd/sys/contrib/openzfs/man/man5/vdev_id.conf.5 (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1*61145dc2SMartin Matuska.\" SPDX-License-Identifier: CDDL-1.0
216038816SMartin Matuska.\"
316038816SMartin Matuska.\" This file and its contents are supplied under the terms of the
416038816SMartin Matuska.\" Common Development and Distribution License ("CDDL"), version 1.0.
516038816SMartin Matuska.\" You may only use this file in accordance with the terms of version
616038816SMartin Matuska.\" 1.0 of the CDDL.
716038816SMartin Matuska.\"
816038816SMartin Matuska.\" A full copy of the text of the CDDL should have accompanied this
916038816SMartin Matuska.\" source.  A copy of the CDDL is also available via the Internet at
1016038816SMartin Matuska.\" http://www.illumos.org/license/CDDL.
1116038816SMartin Matuska.\"
1216038816SMartin Matuska.Dd May 26, 2021
1316038816SMartin Matuska.Dt VDEV_ID.CONF 5
1416038816SMartin Matuska.Os
1516038816SMartin Matuska.
1616038816SMartin Matuska.Sh NAME
1716038816SMartin Matuska.Nm vdev_id.conf
183ff01b23SMartin Matuska.Nd configuration file for vdev_id(8)
1916038816SMartin Matuska.Sh DESCRIPTION
2016038816SMartin Matuska.Nm
21eda14cbcSMatt Macyis the configuration file for
223ff01b23SMartin Matuska.Xr vdev_id 8 .
23eda14cbcSMatt MacyIt controls the default behavior of
243ff01b23SMartin Matuska.Xr vdev_id 8
25eda14cbcSMatt Macywhile it is mapping a disk device name to an alias.
2616038816SMartin Matuska.Pp
27eda14cbcSMatt MacyThe
2816038816SMartin Matuska.Nm
29eda14cbcSMatt Macyfile uses a simple format consisting of a keyword followed by one or
3016038816SMartin Matuskamore values on a single line.
3116038816SMartin MatuskaAny line not beginning with a recognized keyword is ignored.
3216038816SMartin MatuskaComments may optionally begin with a hash character.
3316038816SMartin Matuska.Pp
34eda14cbcSMatt MacyThe following keywords and values are used.
3516038816SMartin Matuska.Bl -tag -width "-h"
3616038816SMartin Matuska.It Sy alias Ar name Ar devlink
3716038816SMartin MatuskaMaps a device link in the
3816038816SMartin Matuska.Pa /dev
3916038816SMartin Matuskadirectory hierarchy to a new device name.
4016038816SMartin MatuskaThe udev rule defining the device link must have run prior to
413ff01b23SMartin Matuska.Xr vdev_id 8 .
42eda14cbcSMatt MacyA defined alias takes precedence over a topology-derived name, but the
4316038816SMartin Matuskatwo naming methods can otherwise coexist.
4416038816SMartin MatuskaFor example, one might name drives in a JBOD with the
4516038816SMartin Matuska.Sy sas_direct
4616038816SMartin Matuskatopology while naming an internal L2ARC device with an alias.
4716038816SMartin Matuska.Pp
4816038816SMartin Matuska.Ar name
4916038816SMartin Matuskais the name of the link to the device that will by created under
5016038816SMartin Matuska.Pa /dev/disk/by-vdev .
5116038816SMartin Matuska.Pp
5216038816SMartin Matuska.Ar devlink
5316038816SMartin Matuskais the name of the device link that has already been
5416038816SMartin Matuskadefined by udev.
5516038816SMartin MatuskaThis may be an absolute path or the base filename.
5616038816SMartin Matuska.
5716038816SMartin Matuska.It Sy channel [ Ns Ar pci_slot ] Ar port Ar name
58eda14cbcSMatt MacyMaps a physical path to a channel name (typically representing a single
59eda14cbcSMatt Macydisk enclosure).
6016038816SMartin Matuska.
6116038816SMartin Matuska.It Sy enclosure_symlinks Sy yes Ns | Ns Sy no
6216038816SMartin MatuskaAdditionally create
6316038816SMartin Matuska.Pa /dev/by-enclosure
6416038816SMartin Matuskasymlinks to the disk enclosure
6516038816SMartin Matuska.Em sg
6616038816SMartin Matuskadevices using the naming scheme from
6716038816SMartin Matuska.Pa vdev_id.conf .
6816038816SMartin Matuska.Sy enclosure_symlinks
6916038816SMartin Matuskais only allowed for
7016038816SMartin Matuska.Sy sas_direct
7116038816SMartin Matuskamode.
7216038816SMartin Matuska.
7316038816SMartin Matuska.It Sy enclosure_symlinks_prefix Ar prefix
7416038816SMartin MatuskaSpecify the prefix for the enclosure symlinks in the form
7516038816SMartin Matuska.Pa /dev/by-enclosure/ Ns Ao Ar prefix Ac Ns - Ns Ao Ar channel Ac Ns Aq Ar num
7616038816SMartin Matuska.Pp
7716038816SMartin MatuskaDefaults to
7816038816SMartin Matuska.Dq Em enc .
7916038816SMartin Matuska.
8016038816SMartin Matuska.It Sy slot Ar prefix Ar new Op Ar channel
81eda14cbcSMatt MacyMaps a disk slot number as reported by the operating system to an
8216038816SMartin Matuskaalternative slot number.
8316038816SMartin MatuskaIf the
8416038816SMartin Matuska.Ar channel
8516038816SMartin Matuskaparameter is specified
86eda14cbcSMatt Macythen the mapping is only applied to slots in the named channel,
8716038816SMartin Matuskaotherwise the mapping is applied to all channels.
8816038816SMartin MatuskaThe first-specified
8916038816SMartin Matuska.Ar slot
9016038816SMartin Matuskarule that can match a slot takes precedence.
9116038816SMartin MatuskaTherefore a channel-specific mapping for a given slot should generally appear
9216038816SMartin Matuskabefore a generic mapping for the same slot.
9316038816SMartin MatuskaIn this way a custom mapping may be applied to a particular channel
9416038816SMartin Matuskaand a default mapping applied to the others.
9516038816SMartin Matuska.
9687bf66d4SMartin Matuska.It Sy zpad_slot Ar digits
9787bf66d4SMartin MatuskaPad slot numbers with zeros to make them
9887bf66d4SMartin Matuska.Ar digits
9987bf66d4SMartin Matuskalong, which can help to make disk names a consistent length and easier to sort.
10087bf66d4SMartin Matuska.
10116038816SMartin Matuska.It Sy multipath Sy yes Ns | Ns Sy no
102eda14cbcSMatt MacySpecifies whether
1033ff01b23SMartin Matuska.Xr vdev_id 8
10416038816SMartin Matuskawill handle only dm-multipath devices.
10516038816SMartin MatuskaIf set to
10616038816SMartin Matuska.Sy yes
10716038816SMartin Matuskathen
1083ff01b23SMartin Matuska.Xr vdev_id 8
109eda14cbcSMatt Macywill examine the first running component disk of a dm-multipath
11016038816SMartin Matuskadevice as provided by the driver command to determine the physical path.
11116038816SMartin Matuska.
11216038816SMartin Matuska.It Sy topology Sy sas_direct Ns | Ns Sy sas_switch Ns | Ns Sy scsi
113eda14cbcSMatt MacyIdentifies a physical topology that governs how physical paths are
11416038816SMartin Matuskamapped to channels:
11516038816SMartin Matuska.Bl -tag -compact -width "sas_direct and scsi"
11616038816SMartin Matuska.It Sy sas_direct No and Sy scsi
11716038816SMartin Matuskachannels are uniquely identified by a PCI slot and HBA port number
11816038816SMartin Matuska.It Sy sas_switch
11916038816SMartin Matuskachannels are uniquely identified by a SAS switch port number
12016038816SMartin Matuska.El
12116038816SMartin Matuska.
12216038816SMartin Matuska.It Sy phys_per_port Ar num
123eda14cbcSMatt MacySpecifies the number of PHY devices associated with a SAS HBA port or SAS
124eda14cbcSMatt Macyswitch port.
1253ff01b23SMartin Matuska.Xr vdev_id 8
126eda14cbcSMatt Macyinternally uses this value to determine which HBA or switch port a
12716038816SMartin Matuskadevice is connected to.
12816038816SMartin MatuskaThe default is
12916038816SMartin Matuska.Sy 4 .
13016038816SMartin Matuska.
13187bf66d4SMartin Matuska.It Sy slot Sy bay Ns | Ns Sy phy Ns | Ns Sy port Ns | Ns Sy id Ns | Ns Sy lun Ns | Ns Sy bay_lun Ns | Ns Sy ses
132eda14cbcSMatt MacySpecifies from which element of a SAS identifier the slot number is
13316038816SMartin Matuskataken.
13416038816SMartin MatuskaThe default is
13516038816SMartin Matuska.Sy bay :
13616038816SMartin Matuska.Bl -tag -compact -width "port"
13716038816SMartin Matuska.It Sy bay
13816038816SMartin Matuskaread the slot number from the bay identifier.
13916038816SMartin Matuska.It Sy phy
14016038816SMartin Matuskaread the slot number from the phy identifier.
14116038816SMartin Matuska.It Sy port
14216038816SMartin Matuskause the SAS port as the slot number.
14316038816SMartin Matuska.It Sy id
14416038816SMartin Matuskause the scsi id as the slot number.
14516038816SMartin Matuska.It Sy lun
14616038816SMartin Matuskause the scsi lun as the slot number.
14787bf66d4SMartin Matuska.It Sy bay_lun
14887bf66d4SMartin Matuskaread the slot number from the bay identifier and append the lun number.
14987bf66d4SMartin MatuskaUseful for multi-lun multi-actuator hard drives.
15016038816SMartin Matuska.It Sy ses
15116038816SMartin Matuskause the SCSI Enclosure Services (SES) enclosure device slot number,
152eda14cbcSMatt Macyas reported by
15316038816SMartin Matuska.Xr sg_ses 8 .
15416038816SMartin MatuskaIntended for use only on systems where
15516038816SMartin Matuska.Sy bay
15616038816SMartin Matuskais unsupported,
15716038816SMartin Matuskanoting that
15816038816SMartin Matuska.Sy port
15916038816SMartin Matuskaand
16016038816SMartin Matuska.Sy id
16116038816SMartin Matuskamay be unstable across disk replacement.
16216038816SMartin Matuska.El
16316038816SMartin Matuska.El
16416038816SMartin Matuska.
16516038816SMartin Matuska.Sh FILES
16616038816SMartin Matuska.Bl -tag -width "-v v"
16716038816SMartin Matuska.It Pa /etc/zfs/vdev_id.conf
16816038816SMartin MatuskaThe configuration file for
1693ff01b23SMartin Matuska.Xr vdev_id 8 .
17016038816SMartin Matuska.El
17116038816SMartin Matuska.
17216038816SMartin Matuska.Sh EXAMPLES
173eda14cbcSMatt MacyA non-multipath configuration with direct-attached SAS enclosures and an
17416038816SMartin Matuskaarbitrary slot re-mapping:
1753ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
176eda14cbcSMatt Macymultipath     no
177eda14cbcSMatt Macytopology      sas_direct
178eda14cbcSMatt Macyphys_per_port 4
179eda14cbcSMatt Macyslot          bay
180eda14cbcSMatt Macy
181eda14cbcSMatt Macy#       PCI_SLOT HBA PORT  CHANNEL NAME
182eda14cbcSMatt Macychannel 85:00.0  1         A
183eda14cbcSMatt Macychannel 85:00.0  0         B
184eda14cbcSMatt Macychannel 86:00.0  1         C
185eda14cbcSMatt Macychannel 86:00.0  0         D
186eda14cbcSMatt Macy
187eda14cbcSMatt Macy# Custom mapping for Channel A
188eda14cbcSMatt Macy
189eda14cbcSMatt Macy#    Linux      Mapped
190eda14cbcSMatt Macy#    Slot       Slot      Channel
191eda14cbcSMatt Macyslot 1          7         A
192eda14cbcSMatt Macyslot 2          10        A
193eda14cbcSMatt Macyslot 3          3         A
194eda14cbcSMatt Macyslot 4          6         A
195eda14cbcSMatt Macy
196eda14cbcSMatt Macy# Default mapping for B, C, and D
197eda14cbcSMatt Macy
198eda14cbcSMatt Macyslot 1          4
199eda14cbcSMatt Macyslot 2          2
200eda14cbcSMatt Macyslot 3          1
201eda14cbcSMatt Macyslot 4          3
20216038816SMartin Matuska.Ed
20316038816SMartin Matuska.Pp
20416038816SMartin MatuskaA SAS-switch topology.
20516038816SMartin MatuskaNote, that the
20616038816SMartin Matuska.Ar channel
2073ff01b23SMartin Matuskakeyword takes only two arguments in this example:
2083ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
209eda14cbcSMatt Macytopology      sas_switch
210eda14cbcSMatt Macy
211eda14cbcSMatt Macy#       SWITCH PORT  CHANNEL NAME
212eda14cbcSMatt Macychannel 1            A
213eda14cbcSMatt Macychannel 2            B
214eda14cbcSMatt Macychannel 3            C
215eda14cbcSMatt Macychannel 4            D
21616038816SMartin Matuska.Ed
21716038816SMartin Matuska.Pp
21816038816SMartin MatuskaA multipath configuration.
2193ff01b23SMartin MatuskaNote that channel names have multiple definitions - one per physical path:
2203ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
221eda14cbcSMatt Macymultipath yes
222eda14cbcSMatt Macy
223eda14cbcSMatt Macy#       PCI_SLOT HBA PORT  CHANNEL NAME
224eda14cbcSMatt Macychannel 85:00.0  1         A
225eda14cbcSMatt Macychannel 85:00.0  0         B
226eda14cbcSMatt Macychannel 86:00.0  1         A
227eda14cbcSMatt Macychannel 86:00.0  0         B
22816038816SMartin Matuska.Ed
22916038816SMartin Matuska.Pp
2303ff01b23SMartin MatuskaA configuration with enclosure_symlinks enabled:
2313ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
232eda14cbcSMatt Macymultipath yes
233eda14cbcSMatt Macyenclosure_symlinks yes
234eda14cbcSMatt Macy
235eda14cbcSMatt Macy#          PCI_ID      HBA PORT     CHANNEL NAME
236eda14cbcSMatt Macychannel    05:00.0     1            U
237eda14cbcSMatt Macychannel    05:00.0     0            L
238eda14cbcSMatt Macychannel    06:00.0     1            U
239eda14cbcSMatt Macychannel    06:00.0     0            L
24016038816SMartin Matuska.Ed
241eda14cbcSMatt MacyIn addition to the disks symlinks, this configuration will create:
2423ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
243eda14cbcSMatt Macy/dev/by-enclosure/enc-L0
244eda14cbcSMatt Macy/dev/by-enclosure/enc-L1
245eda14cbcSMatt Macy/dev/by-enclosure/enc-U0
246eda14cbcSMatt Macy/dev/by-enclosure/enc-U1
24716038816SMartin Matuska.Ed
24816038816SMartin Matuska.Pp
2493ff01b23SMartin MatuskaA configuration using device link aliases:
2503ff01b23SMartin Matuska.Bd -literal -compact -offset Ds
251eda14cbcSMatt Macy#     by-vdev
252eda14cbcSMatt Macy#     name     fully qualified or base name of device link
253eda14cbcSMatt Macyalias d1       /dev/disk/by-id/wwn-0x5000c5002de3b9ca
254eda14cbcSMatt Macyalias d2       wwn-0x5000c5002def789e
25516038816SMartin Matuska.Ed
25616038816SMartin Matuska.
25716038816SMartin Matuska.Sh SEE ALSO
25816038816SMartin Matuska.Xr vdev_id 8
259