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