Solution to inconsistent device IDs and drive letters of Linux virtual machines

Source: Internet
Author: User

Solution to inconsistent device IDs and drive letters of Linux virtual machines

When a user mounts multiple scsi disks, after the Linux virtual machine is restarted, the internal disk ing of the virtual machine is inconsistent with that configured by the user ., The user-configured scsi device id corresponds to the drive letter.

After the VM is restarted, the correspondence between the scsi device id and the drive letter of the VM is different from that configured by the user. As shown in, the scsi device id of the VM is inconsistent with the drive letter:

In this case, when the device corresponding to the drive letter used in Oracle RAC changes, the Service may be affected.

Solution:
When using a VM scsi device, you must specify the scsi device id. This solution is mainly applicable to the scenario where the entire scsi disk is used and the scsi disk is not partitioned inside the VM. Environment: RedHat 6.5 64-bit operating system, for example,/etc/udev/rules. d/60-raw.rules configuration file.
ACTION = "add", KERNEL = "sd *", PROGRAM = "/sbin/scsi_id-g-u-d/dev/$ name ",
RESULT = "360022a11000e085d0de717f500000003", RUN + = "/bin/raw/dev/raw/raw1% N"
ACTION = "add", KERNEL = "sd *", PROGRAM = "/sbin/scsi_id-g-u-d/dev/$ name ",
RESULT = "360022a11000e085d0de7372c0000002e", RUN + = "/bin/raw/dev/raw/raw2% N"
KERNEL = "raw1", OWNER = "grid", GROUP = "oinstall", MODE = "777"
KERNEL = "raw2", OWNER = "grid", GROUP = "oinstall", MODE = "777"

We can get the RESULT in configuration through/sbin/scsi_id-g-u-d/dev/$ name. For example:

When you need to use/dev/sda as the RAC device, you can execute:
#/Sbin/scsi_id-g-u-d/dev/sda
The result is:
#360022a11000e085d0de717f500000003 \ The RESULTRedhat 6.5 64-bit operating system in the configuration, for example,/etc/udev/rules. d/60-raw.rules configuration file.
ACTION = "add", KERNEL = "sd *", PROGRAM = "/sbin/scsi_id-g-u-s % p ",
RESULT = "360022a11000be24a0004aeee0000000a", RUN + = "/bin/raw/dev/raw/raw1% N"
KERNEL = "raw1", OWNER = "grid", GROUP = "oinstall", MODE = "777"

Obtain the RESULT in the configuration by specifying/sbin/scsi_id-g-u-s % p in the PROGRAM. For example:

To use/dev/sda as the RAC device, run the following command:
#/Sbin/scsi_id-g-u-s/block/sda
The result is:
# 360022a11000be24a0004aeee0000000a \ RESULT in configuration

Cause analysis:

When configuring a scsi disk during Oracle RAC installation, the traditional method is to point to a specific drive letter, as shown in/etc/udev/rules. the contents of the d/60-raw.rules configuration file. The KERNEL field indicates the specific drive letter.

ACTION = "add", KERNEL = "sdb", RUN + = "/bin/raw/dev/raw/raw1% N"
ACTION = "add", KERNEL = "sdc", RUN + = "/bin/raw/dev/raw/raw2% N"
ACTION = "add", KERNEL = "sdd", RUN + = "/bin/raw/dev/raw/raw3% N"
KERNEL = "raw1", OWNER = "grid", GROUP = "oinstall", MODE = "777"
KERNEL = "raw2", OWNER = "grid", GROUP = "oinstall", MODE = "777"
KERNEL = "raw3", OWNER = "grid", GROUP = "oinstall", MODE = "777"

The relationship between the device id and drive letter (such as sda \ sdb) presented to the virtual machine in the physical device ing may change after the virtual machine is restarted, for the following reasons:

The Linux kernel determines the sda, sdb, and sdc generation rules. The ing between Linux kernel and such disk devices depends on three sequence: one is the loading of the disk driver; the other is the monitoring of the host's PCI slots; and the other is the monitoring of the disk itself, the first is sda, and so on.

The physical machine restarts after the device is hot-swappable, and the drive letter changes. For example, sda, sdb, and sdc are used before startup. After the sdb device is unplugged and restarted, the displayed device number is sda and sdb (the original sdc ).

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.