Using Udev to bind shared storage on Linux 6

Source: Internet
Author: User

1. How to view the hard drive;
2. Obtain the hard disk scsi (Small computer System Interface) ID;
3. Bind shared storage;
4. Bind the shared storage script;

1. How to view the hard drive:

[[email protected] ~]# ls-Ltr/Dev/Sd*BRW-rw----. 1 root disk 8, 48 August 13:34/DEV/SDDBrw-rw----. 1 Root disk 8, 16 August 13:34/dev/sdbBrw-rw----. 1 Root disk 8, 32 August 13:34/DEV/SDCBrw-rw----. 1 root disk 8, 80 August 13:34/dev/sdfBrw-rw----. 1 root disk 8, 64 August 13:34/dev/sdeBrw-rw----. 1 root disk 8, 0 August 13:34/DEV/SDABrw-rw----. 1 root disk 8, 4 August 13:34/dev/sda4Brw-rw----. 1 root disk 8, 8 August 13:34/dev/sda8Brw-rw----. 1 Root disk 8, 9 August 13:34/dev/sda9Brw-rw----. 1 Root disk 8, 1 August 13:34/dev/sda1Brw-rw----. 1 Root disk 8, 6 August 13:34/dev/sda6Brw-rw----. 1 root disk 8, 3 August 13:34/dev/sda3Brw-rw----. 1 root disk 8, 2 August 13:34/dev/sda2Brw-rw----. 1 Root disk 8, 7 August 13:34/dev/sda7Brw-rw----. 1 Root disk 8, 5 August 13:34/dev/sda5

SDA represents the local hard disk, sda1,2,3,6: Represents the partition on the local hard disk, SDB. F represents a non-local hard disk, whether the specific hard disk partition is mounted on the system, you can use the DF command query:

[[email protected] ~]# DF-htfilesystem Type Size used Avail Use%Mounted on/Dev/Sda9 ext4 62G 551M 58G1% /Tmpfs Tmpfs 499M0499M0% /Dev/SHM/Dev/SDA1 ext4 291M 56M 220M +% /Boot/Dev/Sda6 EXT45.1G 139M4.7G3% /Home/Dev/Sda3 EXT45.1G 161M4.7G4% /opt/Dev/Sda2 Ext4 15G2.9G 12G +% /usr/Dev/Sda7 EXT45.1G 139M4.7G3% /Usr/Local/Dev/Sda5 EXT45.1G 611M4.2G -% /var

2. Obtain the hard disk scsi (Small computer System Interface) ID:
SCSI is a standard physical connection and transfer of data between computers and peripherals, SCSI defines standard commands, protocols, and electrical optical interfaces for hard disk and tape devices, and when configuring shared storage, you need to bind the device through the SCSI ID to the system, and the following operations get the SCSI ID of the shared storage in My computer:

[[email protected] ~]#/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/sdb1ata_vbox_harddisk_vbf1082ced-38C590FB[[email protected] ~]#/Sbin/scsi_id--whitelisted--replace-whitespace--DEVICE=/DEV/SDC1ata_vbox_harddisk_vbcb889b15-45566527[[email protected] ~]#/Sbin/scsi_id--whitelisted--replace-whitespace--DEVICE=/DEV/SDD1ata_vbox_harddisk_vb91e00a0b-5bc96a2b[[email protected] ~]#/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/sde1ata_vbox_harddisk_vbe9eca0fb-a99c152d[[email protected] ~]#/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/sdf1ata_vbox_harddisk_vb414d8bfa-0256c987

3. Bind shared storage:
Establish the Rules file (note format)/etc/udev/rules.d/99-oracle-asmdevices.rules, each entry corresponds to a disk device, program defines the UDEV device name; name defines the Udev device link name, The name will be displayed in the/dev/directory; RESULT defines the device's SCSI id;owner to define the device owner; Group defines the user groups for the device owner:

KERNEL==The SD*", BUS=="SCSI", program=="/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name ", result==" 1ATA_VBOX_HARDDISK_VBF1082CED-38C590FB ",NAME=The ASM-Diskb ", OWNER="Grid",GROUP="Asmadmin", MODE="0660"KERNEL==The SD*", BUS=="SCSI", program=="/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name ", result==" 1ata_vbox_harddisk_vbcb889b15-45566527 ", NAME=The ASM-DISKC ", OWNER="Grid",GROUP="Asmadmin", MODE="0660"KERNEL==The SD*", BUS=="SCSI", program=="//Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name ", result==" 1ata_vbox_harddisk_vb91e00a0b-5bc96a2b ",NAME=The ASM-DISKD ", OWNER="Grid",GROUP="Asmadmin", MODE="0660"KERNEL==The SD*", BUS=="SCSI", program=="/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name ", result==" 1ata_vbox_harddisk_vbe9eca0fb-a99c152d ",NAME=The ASM-Diske ", OWNER="Grid",GROUP="Asmadmin", MODE="0660"KERNEL==The SD*", BUS=="SCSI", program=="/Sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name ", result==" 1ata_vbox_harddisk_vb414d8bfa-0256c987 ",NAME=The ASM-DISKF ", OWNER="Grid",GROUP="Asmadmin", MODE="0660"

Restart Udev:

[[email protected] ~] /sbin/

To view the shared storage after binding:

 [ [email protected] ~  ]  # ls - ltr / Dev/ Asm*  BRW  - rw-- . 1 Grid asmadmin 8, 32 August 15:27/DEV/ASM-DISKC  brw- rw-- --. 1 grid asmadmin 8, 16 August 15:27/dev/asm-diskb  brw- rw--. 1 grid asmadmin 8, 48 August 17 15:27/ DEV/ASM-DISKD  

4. Bind the shared storage script:
The above is the process of binding shared storage, the purpose is to understand how to do, if the configuration is not looked at the shared storage, please carefully check the configuration, any configuration error will cause Udev startup failure; The following script is an automatic configuration of shared storage.
When used, modify according to the actual situation:

 for inch b c d E F g;d Oecho "KERNEL = =\ "SD*\",BUS = =\ "scsi\", program= =\ "/sbin/-- 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.rulesdone;

For example: When only/DEV/SDC,/DEV/SDD, the script for i in B c D E F g is modified to for I in C D;
Finally restart Udev:

[[email protected] ~] /sbin/

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.