This is for systems with external or network storage; that is, Fibre Channel or iSCSI based storage devices. It is recommended that those systems have persistent device names configured for the hosts. This assists live migration as well as providing consistent device names and storage for multiple virtualized systems.
Universally Unique Identifier (UUID) is a standardized method for identifying computers and devices in distributed computing environments. This section uses UUIDs to identify iSCSI or Fibre Channel LUNs. UUIDs persist after restarting, disconnection and device swaps. The UUID is similar to a label on the device. Systems which are not running multipath must use Single path configuration. Systems running multipath can use Multiple path configurations.
Single path configuration for CentOS/RHEL 5
This procedure implements LUN device persistence using udev. Only use this procedure for hosts which are not using multipath
1. Edit the /etc/scsi_id.config file. Ensure the line with “options=-b” is commented out and parameter “options=-g” is to be added to this file.
# vi /etc/scsi_id.config # options=-b options=-g
This option configures udev to assume all attached SCSI devices return a UUID.
2. To display the UUID for a given device run the “scsi_id -g -s /block/sd*” command. For example:
# scsi_id -g -s /block/sd* 3600a0b800013275100000015427b625e
The output may vary from the example above. The output displays the UUID of the device /dev/sdc.
3. Verify the UUID output by the “scsi_id -g -s /block/sd*” command is identical from computer which accesses the device.
4. Create a rule to name the device. Create a file named “20-names.rules” in the /etc/udev/rules.d directory. Add new rules to this file. All rules are added to the same file using the same format. Rules follow this format:
# vi /etc/udev/rules.d/20-names.rules KERNEL=="sd[a-z]", BUS=="scsi", PROGRAM="/sbin/scsi_id -g -s /block/%k", RESULT="UUID", NAME="devicename"
Replace UUID and devicename with the UUID retrieved above, and a name for the device. This is a rule for the example above:
KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id -g -s", RESULT="3600a0b800013275100000015427b625e", NAME="rack4row16"
The udev daemon now searches all devices named /dev/sd* for the UUID in the rule. Once a matching device is connected to the system the device is assigned the name from the rule. In the a device with a UUID of 3600a0b800013275100000015427b625e would appear as /dev/rack4row16.
5. Append below line to /etc/rc.local file:
# vi /etc/rc.local /sbin/start_udev
6. Copy the changes in the /etc/scsi_id.config, /etc/udev/rules.d/20-names.rules and /etc/rc.local files to all relevant hosts.
/sbin/start_udev
Single path configuration for CentOS/RHEL 6
This procedure implements LUN device persistence using udev. Only use this procedure for hosts which are not using multipath.
1. Edit the /etc/scsi_id.config file. Add the following line:
# vi /etc/scsi_id.config options=--whitelisted --replace-whitespace
This sets the default options for scsi_id, ensuring returned UUIDs contains no spaces. The IET iSCSI target otherwise returns spaces in UUIDs, which can cause problems.
2. To display the UUID for a given device run the below command:
# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc 1IET_00010001
The output may vary from the example above. The output in this example displays the UUID of the device /dev/sdc.
3. Verify the UUID output from the command is correct and as expected.
4. Create a rule to name the device. Create a file named “20-names.rules” in the /etc/udev/rules.d directory. Add new rules to this file. All rules are added to the same file using the same format. Rules follow this format:
# vi /etc/udev/rules.d/20-names.rules KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM="/sbin/scsi_id --whitelisted --replace-whitespace /dev/$name", RESULT=="UUID", NAME="devicename"
Replace “UUID and devicename” with the UUID retrieved above, and a name for the device. This is an example for the rule above for three example iSCSI luns:
The udev daemon now searches all devices named /dev/sd* for a matching UUID in the rules. When a matching device is connected to the system the device is assigned the name from the rule. For example:
# ls -la /dev/rack4row16* brw-rw---- 1 root disk 8, 18 May 25 23:35 /dev/rack4row16lun1 brw-rw---- 1 root disk 8, 34 May 25 23:35 /dev/rack4row16lun2 brw-rw---- 1 root disk 8, 50 May 25 23:35 /dev/rack4row16lun3
5. Copy the changes in /etc/scsi_id.config and /etc/udev/rules.d/20-names.rules to all relevant hosts.
Network storage devices with configured rules now have persistent names on all hosts where the files were updated This means it is possible to migrate guests between hosts using the shared storage and the guests can access the storage devices in their configuration files.