Linux disk device files (SDA,SDB,SDC ...) Change issues

Source: Internet
Author: User
Tags uuid uuid identifier

In Linux, often encounter such a problem, disk equipment files, such as/DEV/SDA, SDB, SDC and so on in some cases will be confused, such as SDA into SDB or SDC into SDB and so on, which will virtually lead to the chaos of disk device management, The most common example of Linux file system startup issues. Many people in this situation to find disk, array manufacturers, suspect is their problem, in fact, the underlying disk (a single disk or RAID array) and Linux under the disk device file mapping is not the disk, array manufacturers to determine, but the Linux kernel itself.

At present, the Linux kernel for this disk device mapping basically depends on three sequence, one is the disk driver loading, the second is the host PCI slot monitoring, the third is the disk itself monitoring, first of all, of course a, and so on. Therefore, in the case of hot-swappable devices, reboots, and other special cases, the actual disk under Linux mapped device files may be due to this "queuing" cause of the change, and this bottom "sneak" change sometimes let the administrator make some low-level errors.

This is the Linux kernel limit, so there is no way to face the positive response, but there are two "circuitous tactics" approach to reduce the possible problems, one is to use the UUID device unique identification method, and the other is the use of the device volume label identification methods.

One, UUID (globally unique identifier), the only identification, is the SCSI Inquiry Command page 83 information to map the disk device. For example, we can query the UUID identifier code of some disk devices under Linux.

<ccid_nobr>

<ccid_code>bash# ls-la/dev/disk/by-idtotal 0drwxr-xr-x 2 root root 280 Mar 12:29. drwxr-xr-x 5 root root R 11 12:28.. lrwxrwxrwx 1 root root 9 Mar 12:29 edd-int13_dev80. /.. /sdalrwxrwxrwx 1 root root 12:29 edd-int13_dev80-part1. /.. /sda1lrwxrwxrwx 1 root root 12:29 edd-int13_dev80-part3. /.. /sda3lrwxrwxrwx 1 root root 12:29 edd-int13_dev80-part4. /.. /sda4lrwxrwxrwx 1 root root 12:29 edd-int13_dev80-part5. /.. /sda5lrwxrwxrwx 1 root root 12:29 edd-int13_dev80-part6. /.. /SDA6LRWXRWXRWX 1 root root 9 Mar 12:28 scsi-3600050e03d7c67007bf400009f890000. /.. /sdalrwxrwxrwx 1 root root 12:28 scsi-3600050e03d7c67007bf400009f890000-part1. /.. /sda1lrwxrwxrwx 1 root root 12:28 scsi-3600050e03d7c67007bf400009f890000-part3. /.. /sda3lrwxrwxrwx 1 root root 12:28 scsi-3600050e03d7c67007bf400009f890000-part4. /.. /sda4lrwxrwxrwx 1 root root 12:28 scsi-3600050e03d7c67007bf400009f890000-part5. /.. /sda5lrwxrwxrwx 1 root root 12:28 scsi-3600050e03d7c67007bf400009f890000-part6. /.. /sda6

Once the disk device's unique UUID code is found, it can be added to/etc/grub.conf and/etc/fstab, so that even if the initial system disk SDA becomes SDB, the Linux and file system boot loads are based on the UUID, so the upper layer is not affected, For example

Make the following changes in the/ETC/GRUB.CONF system boot Portal:

<ccid_nobr>

<ccid_code>kernel/boot/vmlinuz-2.6.27.7 Root=/dev/disk/by-id/scsi-3600050e03d7c67007bf400009f890000-part1

Make the following changes in the/etc/fstab file System boot Portal:

<ccid_nobr>

<ccid_code>/dev/disk/by-id/scsi-3600050e03d7c67007bf400009f890000-part1/          ext3   1  1/dev/disk/ By-id/scsi-234892819987c8f828473829becf38289-part2/home      ext3   1  1

Second, a relatively old-fashioned solution, that is, the disk volume Set label label, the same reason, the system starts when only look at the label, do not look at the underlying SDA/SDB and other device numbers, so it will not affect the system, file system startup. For example

Use the E2label command to set the label for SDA1 and SDB1:

<ccid_nobr>

<CCID_CODE>/SBIN/E2LABEL/DEV/SDA1 MYROOT/SBIN/E2LABEL/DEV/SDB1 MyHome

After that, make the following changes in the/ETC/GRUB.CONF system boot Portal:

<ccid_nobr>

<ccid_code>kernel/boot/vmlinuz-2.6.29 ro Root=label=myroot

Make the following changes in the/etc/fstab file System boot Portal:

<ccid_nobr>

<ccid_code>label=myroot      /      ext3  defaults  1 1label=myhome/home  ext3  Defaults  1 1

Of course, the above two are to not affect the system and file system start using the workaround, in the actual system management or to pay close attention to the changes in the underlying equipment, or if there is a disk partition mistakenly deleted things can be a big crime.

Linux disk device files (SDA,SDB,SDC ...) Change issues

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.