Use UDEV to bind shared storage on Linux 6

Source: Internet
Author: User

Use UDEV to bind shared storage on Linux 6

1. view the hard disk;
2. Obtain the hard disk SCSI (Small Computer System Interface) ID;
3. Bind shared storage;
4. Bind the shared storage script;

1. Hard Disk viewing method:

[Root @ cl6-11gr2-rac1 ~] # Ls-ltr/dev/sd *
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sdd
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sdb
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sdc
Brw-rw ----. 1 root disk 8, 80 August 16 13:34/dev/sdf
Brw-rw ----. 1 root disk 8, 64 August 16 13:34/dev/sde
Brw-rw ----. 1 root disk 8, 0 August 16 13:34/dev/sda
Brw-rw ----. 1 root disk 8, 4 August 16 13:34/dev/sda4
Brw-rw ----. 1 root disk 8, 8 Aug 17 13:34/dev/sda8
Brw-rw ----. 1 root disk 8, 9 August 16 13:34/dev/sda9
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sda1
Brw-rw ----. 1 root disk 8, 6 August 16 13:34/dev/sda6
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sda3
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sda2
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sda7
Brw-rw ----. 1 root disk 8, August 16 13:34/dev/sda5

Sda represents the local hard disk, sda1, 2, 3, 6 .. represents the partition on the local hard disk, sdb .. f indicates a non-local hard disk. You can run the df command to check whether the hard disk partition is mounted to the system:

[Root @ cl6-11gr2-rac1 ~] # Df-hT
Filesystem Type Size Used Avail Use % Mounted on
/Dev/sda9 ext4 62G 551 M 58G 1%/
Tmpfs 499 M 0 499 M 0%/dev/shm
/Dev/sda1 ext4 291 M 56 M 220 M 21%/boot
/Dev/sda6 ext4 5.1G 139 M 4.7G 3%/home
/Dev/sda3 ext4 5.1G 161 M 4.7G 4%/opt
/Dev/sda2 ext4 15G 2.9G 12G 21%/usr
/Dev/sda7 ext4 5.1G 139 M 4.7G 3%/usr/local
/Dev/sda5 ext4 5.1G 611 M 4.2G 13%/var

 

2. Obtain the hard disk SCSI (Small Computer System Interface) ID:
SCSI is a standard physical connection and data transmission between computers and peripheral devices. SCSI defines Standard Commands, protocols, and electrical optical interfaces for hard disks and tape devices, when configuring shared storage, You need to bind the device to the system through the scsi id. The following operations get the shared storage scsi id on my local machine:

 

[Root @ cl6-11gr2-rac1 ~] #/Sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sdb
1ATA_VBOX_HARDDISK_VBf1082ced-38c590fb
[Root @ cl6-11gr2-rac1 ~] #/Sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sdc
1ATA_VBOX_HARDDISK_VBcb889b15-45566527
[Root @ cl6-11gr2-rac1 ~] #/Sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sdd
1ATA_VBOX_HARDDISK_VB91e00a0b-5bc96a2b
[Root @ cl6-11gr2-rac1 ~] #/Sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sde
1ATA_VBOX_HARDDISK_VBe9eca0fb-a99c152d
[Root @ cl6-11gr2-rac1 ~] #/Sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sdf
1ATA_VBOX_HARDDISK_VB414d8bfa-0256c987

 

3. Bind shared storage:
Create a rules file (note the format)/etc/udev/rules. d/99-Oracle-asmdevices.rules. Each entry corresponds to a disk device. The PROGRAM defines the UDEV device NAME. The NAME defines the UDEV device link NAME, which will be displayed in the/dev/directory; RESULT defines the scsi id of the device; OWNER defines the device OWNER; GROUP defines the user GROUP of the device OWNER:

 

KERNEL = "sd *", BUS = "scsi", PROGRAM = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", RESULT = "1ATA_VBOX_HARDDISK_VBf1082ced-38c590fb", NAME = "asm-diskb", OWNER = "grid", GROUP = "asmadmin", MODE = "0660"
KERNEL = "sd *", BUS = "scsi", PROGRAM = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", RESULT = "1ATA_VBOX_HARDDISK_VBcb889b15-45566527", NAME = "asm-diskc", OWNER = "grid", GROUP = "asmadmin", MODE = "0660"
KERNEL = "sd *", BUS = "scsi", PROGRAM = "// sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", RESULT = "1ATA_VBOX_HARDDISK_VB91e00a0b-5bc96a2b", NAME = "asm-diskd", OWNER = "grid", GROUP = "asmadmin", MODE = "0660"
KERNEL = "sd *", BUS = "scsi", PROGRAM = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", RESULT = "1ATA_VBOX_HARDDISK_VBe9eca0fb-a99c152d", NAME = "asm-diske", OWNER = "grid", GROUP = "asmadmin", MODE = "0660"
KERNEL = "sd *", BUS = "scsi", PROGRAM = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", RESULT = "1ATA_VBOX_HARDDISK_VB414d8bfa-0256c987", NAME = "asm-diskf", OWNER = "grid", GROUP = "asmadmin", MODE = "0660"

 

Restart UDEV:

[Root @ cl6-11gr2-rac2 ~] #/Sbin/start_udev

View the bound shared storage:

[Root @ cl6-11gr2-rac2 ~] # Ls-ltr/dev/asm *
Brw-rw ----. 1 grid asmadmin 8, August 17 15:27/dev/asm-diskc
Brw-rw ----. 1 grid asmadmin 8, 16 Aug 17 15:27/dev/asm-diskb
Brw-rw ----. 1 grid asmadmin 8, 48 Aug 17 15:27/dev/asm-diskd

4. Bind the shared storage script:
The above is the process of binding shared storage to learn how to do it. If the shared storage is not found after the configuration is complete, check the configuration carefully. Any configuration error will cause UDEV to fail to start; the following script automatically configures shared storage,
Modify the settings as needed:

For I in B c d e f g;
Do
Echo "KERNEL = \" sd * \ ", BUS = \" scsi \", PROGRAM = \ "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/\ $ name \", RESULT = \ "'/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/sd $ I '\", NAME = \ "asm-disk $ I \", OWNER = \ "grid \", GROUP = \ "asmadmin \", MODE = \ "0660 \" ">/etc/udev/rules. d/99-oracle-asmdevices.rules
Done;

For example, when only/dev/sdc and/dev/sdd are available, change the script for I in B c d e f g to for I in c d;
Finally, restart UDEV:

[Root @ cl6-11gr2-rac2 ~] #/Sbin/start_udev

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.