Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of restart disk letter confusion in linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how the linux system to solve the problem of restart disk letter disorder, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Treatment of linux disk restart disorder problem

Recently, when visiting customers for inspection, customers mentioned a problem. When their rac is restarted, the original sda1, sdb1 and sdc1 will correspond to sdd1, sde1 and sdf1. Because they use a drive letter to bind bare devices, they often have to execute the following command manually after startup.

[root@ractest1 ~] # raw/ dev/raw/raw1 / dev/sda1

[root@ractest1 ~] # raw/ dev/raw/raw2 / dev/sdb1

[root@ractest1 ~] # raw/ dev/raw/raw3 / dev/sdc1

And, oddly enough, the two sides sometimes recognize completely different disks, sda\ b\ c on one side and sdd\ e\ f on the other, which causes problems with oracle rac's shared disk.

After learning about their situation, I basically understand the reason. This disorder is related to the disk scanning mechanism of linux, so we can only avoid this problem from another angle and use the id number to bind, so there will be no problem. After telling him, he agreed that we should modify his original binding method, as follows:

[root@ractest1 ~] # fdisk-l

Disk / dev/sdd: 429.4 GB, 429496729600 bytes

255 heads, 63 sectors/track, 52216 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sdd1 1 52216 419424988 + 83 Linux

Disk / dev/sde: 209 MB, 209715200 bytes

7 heads, 58 sectors/track, 1008 cylinders

Units = cylinders of 406 * 512 = 207872 bytes

Device Boot Start End Blocks Id System

/ dev/sde1 1 1008 204595 83 Linux

Disk / dev/sdf: 209 MB, 209715200 bytes

7 heads, 58 sectors/track, 1008 cylinders

Units = cylinders of 406 * 512 = 207872 bytes

Device Boot Start End Blocks Id System

/ dev/sdf1 1 1008 204595 83 Linux

As you can see, the node 1 that has just been restarted is sdd/sde/sdf

In the case of the other node:

[root@ractest2 ~] # fdisk-l

Disk / dev/sda: 429.4 GB, 429496729600 bytes

255 heads, 63 sectors/track, 52216 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sda1 1 52216 419424988 + 83 Linux

Disk / dev/sdb: 209 MB, 209715200 bytes

7 heads, 58 sectors/track, 1008 cylinders

Units = cylinders of 406 * 512 = 207872 bytes

Device Boot Start End Blocks Id System

/ dev/sdb1 1 1008 204595 83 Linux

Disk / dev/sdc: 209 MB, 209715200 bytes

7 heads, 58 sectors/track, 1008 cylinders

Units = cylinders of 406 * 512 = 207872 bytes

Device Boot Start End Blocks Id System

/ dev/sdc1 1 1008 204595 83 Linux

Execute the following command on both machines:

[root@ractest2] scsi_id-g-s / block/sda

360080e500017ff06000004054c47bd4a

[root@ractest2] scsi_id-g-s / block/sdb

360080e500017fdd8000004c74c6344ef

[root@ractest2] scsi_id-g-s / block/sdc

360080e500017ff060000044f4c63446e

[root@ractest1] scsi_id-g-s / block/sdd

360080e500017ff06000004054c47bd4a

[root@ractest1] scsi_id-g-s / block/sde

360080e500017fdd8000004c74c6344ef

[root@ractest1] scsi_id-g-s / block/sdf

360080e500017ff060000044f4c63446e

By comparison, you can see that sda and sdd,sdb and sde,sdc and sdf are for applications, so we enable udev and avoid this problem by binding id!

[root@ractest1 ~] # cd / etc/udev/rules.d/

[root@ractest1 rules.d] # ls-a

. 50-udev.rules 60-pcmcia.rules 61-uinput-wacom.rules 90-hal.rules

.. 51-hotplug.rules 60-raw.rules 85-pcscd_ccid.rules 95-pam-console.rules

05-udev-early.rules 60-libsane.rules 60-wacom.rules 90-alsa.rules 98-kexec.rules

40-multipath.rules 60-net.rules 61-uinput-stddev.rules 90-dm.rules bluetooth.rules

[root@ractest1 rules.d] # vi 60-raw.rules

# Enter raw device bindings here.

#

# An example would be:

# ACTION== "add", KERNEL== "sda", RUN+= "/ bin/raw / dev/raw/raw1% N"

# to bind / dev/raw/raw1 to / dev/sda, or

# ACTION== "add", ENV {MAJOR} = = "8", ENV {MINOR} = = "1", RUN+= "/ bin/raw / dev/raw/raw2% M% m"

# to bind / dev/raw/raw2 to the device with major 8, minor 1.

ACTION== "add", KERNEL== "sd*1", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "360080e500017ff060000044f4c63446e", RUN+= "/ bin/raw / dev/raw/raw1% N"

ACTION== "add", KERNEL== "sd*1", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "360080e500017fdd8000004c74c6344ef", RUN+= "/ bin/raw / dev/raw/raw2% N"

ACTION== "add", KERNEL== "sd*1", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "360080e500017ff06000004054c47bd4a", RUN+= "/ bin/raw / dev/raw/raw3% N"

KERNEL== "raw [1-3]", OWNER= "oracle", GROUP= "dba", MODE= "660"

[root@ractest1 rules.d] # start_udev

Starting udev: [OK]

[root@ractest1 rules.d] #

[root@ractest1 rules.d] # raw-qa

/ dev/raw/raw1: bound to major 8, minor 81

/ dev/raw/raw2: bound to major 8, minor 65

/ dev/raw/raw3: bound to major 8, minor 49

In the same way, the same operation is done on another machine.

After the above operation, all the problems have been solved, no matter how to restart there will be no problem!

Thank you for reading this article carefully. I hope the article "how to solve the problem of restarting disk letter disorder in linux system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report