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

Example Analysis of mknod Command in linux

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

Share

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

Editor to share with you the example analysis of the mknod command in linux, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

When installing ORACLE RAC under LINUX, when building an ASM disk group, it is sometimes encountered that the disk letters mapped by the storage on the two nodes are inconsistent, sometimes the physical paths are the same, but the paths are not the same after aggregation, and sometimes even the physical paths are not the same. In this case, you need to modify the disk letters on the two nodes to be consistent.

To solve this problem, we must first confirm the corresponding relationship between the LUN ID and the disk, and confirm the corresponding relationship between the two node disks. Find the LUN ID that stores the disks mapped to the host, find the disk correspondence of the same LUN ID between the two hosts, and modify the settings to correspond with the MKNOD command of LINUX.

The mknod command is used to create a device file, a special file. First of all, we have to understand what the device file is. To put it simply, the operating system communicates with external devices (disk drives, printers, terminals, etc.) through device files. Before the Unix/Linux system communicates with external devices, the device must first have a device file, which is placed in the / dev directory. In general, when installing the system, the system automatically creates a lot of device files that have been detected, but sometimes we also need to create them manually. The command line generates device files in insf,mksf,mknod and so on.

The standard form of mknod command is: mknod DEVNAME {b | c} MAJOR MINOR

Parameter explanation:

DEVNAME is the file name of the device to be created. If you want to put the device files in a specific folder, you need to create a new directory under the dev directory with mkdir.

B and c represent block devices and character devices, respectively:

B means that when the system accesses a device through a block device file, it first reads or writes data from the buffer in memory, rather than directly transferring the data to the physical disk, which can effectively improve the Imando performance of the disk and CD-ROMS. Disk and CD-ROMS can use either character device files or block device files.

C means character device files and devices transmit data in the form of characters, one character at a time. For example, printers and terminals all transmit data in the form of characters.

MAJOR and MINOR denote the primary and secondary numbers, respectively. In order to manage devices, the system assigns a number to each device, and a device number consists of a primary device number and a secondary device number. The primary device number indicates a certain type of device, while the secondary device number is used to distinguish the same type of equipment. In the linux operating system, 32-bit unsigned integers are assigned to the device file number, in which the first 12 digits are the primary device number and the last 20 digits are the secondary device number, so when applying for the device file from the system, the primary device number is not more than 4095 and the secondary device number is not more than 2 ^ 20-1.

Example configuration:

Discover the LUN ID of storage mapped to the disk of the host

According to the one-to-one corresponding WWN value, set the drive letter of the two nodes corresponding to the corresponding WWN to be the same:

11.11.10.56

# mknod / dev/rdisk/data5disk c 13 0x000013

# mknod / dev/rdisk/data6disk c 13 0x000014

# mknod / dev/rdisk/data7disk c 13 0x000015

# mknod / dev/rdisk/data8disk c 13 0x000016

11.11.10.57

# mknod / dev/rdisk/data5disk c 13 0x000025

# mknod / dev/rdisk/data6disk c 13 0x000026

# mknod / dev/rdisk/data7disk c 13 0x000027

# mknod / dev/rdisk/data8disk c 13 0x000028

Set the permissions of the two nodes corresponding to the drive letter path:

# chown oracle:oinstall / dev/rdisk/data5disk

# chown oracle:oinstall / dev/rdisk/data6disk

# chown oracle:oinstall / dev/rdisk/data7disk

# chown oracle:oinstall / dev/rdisk/data8disk

Verify read and write permissions with ORACLE users

$dd if=/dev/zero f=/dev/rdisk/data5disk count=10 count=1024

Add disks to the ASM disk group on one of the nodes

Export ORACLE_SID=+ASM2

Sqlplus / as sysdba

Alter diskgroup DATADG add disk' / dev/rdisk/data5disk'

Alter diskgroup DATADG add disk' / dev/rdisk/data6disk'

Alter diskgroup DATADG add disk' / dev/rdisk/data7disk'

Alter diskgroup DATADG add disk' / dev/rdisk/data8disk'

The above is all the contents of the article "sample Analysis of mknod commands in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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