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

Device file management method

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

Share

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

2 _ device file management method devfsLinux early static management method / dev directory from a large number of static files kernel version 2.6.13 has been completely replaced udev only devices connected to the system to create device files under / dev independent of primary and secondary device numbers to provide persistence for devices, Consistent naming rules for devices named access device event chain kernel discovery device and import device state to sysfsudev to receive event domination udev to create device node or run the specified program udev to notify the hald daemon HAL probe device information HAL to create device object structure HAL broadcast the event user program through the system message bus can also monitor the role of the event udev from When the kernel receives an add / a hardware event Udev will analyze: / sys directory information / rules in the etc/udev/rules.d directory based on the analysis results, udev will: process device naming determines which device files or links to create, decide how to set properties to determine which events work processes are triggered, when the device is connected, information with fixed device information (capacity, manufacturer, model) will be loaded into memory Store it in the udev configuration file to get the information that has been accessed into the device. Write the udev rule file vim / etc/udev/rules.d/50-iscsidisk.rules / / File naming rule 1. "-" must be followed by a description. The udev main configuration file vim / etc/udev/udev.conf / / is processed in detail at the end of .rules, without processing. Just keep the default udev_root: create device file location, default is / dev udev_rules:udev rule file location, default is / etc/udev/rules.d udev_log:syslog priority, default is err experiment: problem: in linux system, all devices are files. Due to the different loading order of new devices, the file names of the same devices under / dev are different. Purpose: when the device is connected to the system, the system automatically creates a link file for the same device, and when it operates on the shared device in the future, it can use the link file to operate the device, and prepare for solving the experimental problem: client50:192.168.4.50storage51:192.168.4.511. Display the equipment information of the system udevadm monitor-property2. Get the physical path of the device udevadm info-Q path-n / dev/sdd / devices/platform/host4/session2/target4:0:0/4:0:0:0/block/sdd3. View the parameter information key type udevadm info-Q all-p / devices/platform/host4/session2/target4:0:0/4:0:0:0/block/sdd-a UBSYSTEM== "block" / / device type identified by the system Is a block device ATTR {size} = = "10483712" / / the size of the device ATTRS {model} = = "diskb" / / the model of the device, the space cannot be missing ATTRS {vendor} = = "LIO-ORG" / / manufacturer information 4. Write the above information into / etc/udev/rules.d/50-iscsidisk.rulesUBSYSTEM== "block", ATTR {size} = = "10483712", ATTRS {model} = = "diskb", ATTRS {vendor} = = "LIO-ORG", SYMLINK+= "iscsi/vdc" / / when the device is logged in, a link / dev/iscsi/vdc is created for the device, and the space after each comma cannot be less SYMLINK+= "iscsi/vdc indicates a soft connection for the device. The path is / dev/iscsi/vdc5. Verification: log out the iscsi device and log in again Check the existence of the ls / dev/iscsi/vdc link file to log out the device iscsiadm-- mode node-- targetname iqn.2018-10.cn.tedu.storage51:vdb-- portal 192.168.1.1-- logout login device iscsiadm-- mode node-- targetname iqn.2018-10.cn.tedu.storage51:vdb-- portal 192.168.1.1 -login configuration Multipath multipath problem: the sharing of network storage devices between single network card connections is unreliable It is easy to disconnect sharing due to non-man-made destruction, which leads to the setting of multiple network cards, and then allows multiple network cards to connect the same device to the same device. However, when multiple network cards are connected to the same shared device, different connections to the same device cannot be redundant to each other, making the connection meaningless. Purpose: to form mutual redundancy and backup when multiple network cards are connected to the same shared device. High availability preparation: add network card eth2client50:192.168.2.50storage51:192.168.2.51 to log out iscsi device Log in to] # iscsiadm-- mode discoverydb-- type sendtargets-- portal 192.168.2.51-- discover / / Discovery] # iscsiadm-- mode node-- targetname / / Log in iqn.2018-10.cn.tedu.storage51:vdb-- portal 192.168.2.51RV 3260-- login] # iscsiadm-- mode discoverydb-- type sendtargets-- portal 192.168.4.51-- discover / / Discovery] # iscsiadm-- mode node-- targetname / / Log in iqn.2018-10.cn.tedu.storage51:vdb-- portal 192.168.4.51 targetname 3260-- login installs the multipath package yum-y install device-mapper-multipath.x86_64 mpathconf-- user_friendly_names n / / sets the following unfriendly ways Configuration file ls / etc/multipath.conf / / the file generated by the previous command / usr/lib/udev/scsi_id-- whitelisted-- device=/dev/sda 360014051854c2ad423e4170a9e4ca149 / / the device is an iscsi device There will be a value configuration / etc/multipath.conf file vim / etc/multipath.conf / / the contents here remain unchanged 23 defaults {24 user_friendly_names no / / the following configuration file 25 find_multipaths yes 26} / / the following is a new 97 multipaths {98 Multipath {99 wwid "360014051854c2ad423e4170a9e4ca149" 100 alias mpatha 101} 102} enable Multipath multipathing And test multipath-rr / / reload multipath information |-+-policy='service-time 0' prio=1 status=enabled | `- 14policy='service-time 0prio=1 status=enabled 0sda 0sda 8:0 active ready running`-+-policy='service-time 0' prio=1 status=enabled `- 15 policy='service-time 0prio=1 status=enabled 0prio=1 status=enabled / / View multipath information ifdown eth2 multipath-rr / / re-add After loading, the information of one network port will be missing |-+-policy='service-time 0' prio=1 status=enabled | `- 14 sda 0l0 sda 0 active ready running multipath-ll all the above experiments are based on Red Hat Enterprise Linux Server release 7.4 (Maipo)

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