In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the mounting method of multi-path and high-capacity hard disk under CentOS". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the mounting method of multi-path and high-capacity hard disk under CentOS".
1. Application environment and requirements the blade server connects HP storage through the fiber switch, forming a 2X2 link. The operating system is CentOS 6.464-bit mounted storage capacity of 2.5T
Based on this application environment, two problems need to be solved:
In order to ensure the stability and transmission performance of the link, the multipath technology can be used; the mounted storage hard disk exceeds 2T MBR partition format can not be supported, so the GPT partition format needs to be used.
Because the HP storage driver is already included in CentOS 6.4, the mounted storage hard disk will be automatically identified, otherwise, the storage driver needs to be installed first.
2. What is multipath
Ordinary computer mainframe is a hard disk attached to a bus, here is an one-to-one relationship. When it comes to the SAN environment composed of optical fiber, or the IPSAN environment composed of iSCSI, because the host and storage are connected through the optical fiber switch or multiple network cards and IP, then it constitutes a many-to-many relationship. That is, there can be multiple paths from the host to the storage. The IO from the host to the storage can be selected by multiple paths. Each host can go through several different paths to the corresponding storage. If it is used at the same time, how is the Icano traffic allocated? One of the paths is broken, how to deal with it? And from the operating system's point of view, each path will be regarded as an actual physical disk, but in fact it is only a different path to the same physical disk, which brings confusion to the user when using it. Multipath software came into being to solve the above problems.
The main function of multipathing is to work with storage devices to achieve the following functions:
1. Failure switching and recovery
Load balancing of 2.IO traffic
3. Virtualization of disk
Because multipath software needs to be used in conjunction with storage, different vendors provide different versions based on different operating systems. And some manufacturers, software and hardware are not sold together, if you want to use multipath software, you may need to buy license from manufacturers. For example, EMC's multipath software based on linux needs to buy license separately. Fortunately, the kernel of RedHat and Suse 2.6 comes with a free multipath package that can be used for free, and it is also a general-purpose package that can support devices from most storage vendors, even if some are not well-known vendors, they can support and run well by making minor changes to the configuration file.
The more intuitive feeling is that when you execute the fdisk-l command on the Linux system, hard drives like / dev/sda1, / dev/sdb1, / dev/sdc1, / dev/sdd1 will appear. Because there are four combined paths, the Linux system treats each hop link as a hard drive mounted.
3. Introduction to multipath under Linux
In CentOS 6. 4, multipath is installed by default:
[root@localhost ~] # rpm-qa | grep mapper device-mapper-multipath-0.4.9-64.el6.x86_64 device-mapper-event-libs-1.02.77-9.el6.x86_64 device-mapper-multipath-libs-0.4.9-64.el6.x86_64 device-mapper-persistent-data-0.1.4-1.el6.x86_64 device-mapper-libs-1.02.77-9.el6.x86_64 device-mapper-event-1. 02.77-9.el6.x86_64 device-mapper-1.02.77-9.el6.x86_64
Device-mapper-multipath: multipath-tools. Mainly provides tools such as multipathd and multipath and configuration files such as multipath.conf. These tools create and configure multipath devices through the interface of device mapper's ioctr (call device-mapper 's user space library, and the multipath devices created will be in / dev / mapper).
Device-mapper: it consists of two main parts: the kernel part and the user part.
The kernel part is mainly composed of device mapper core (dm.ko) and some target driver (md-multipath.ko). The core completes the mapping of the device, while target specifically deals with the iUnix from mappered device according to the mapping relationship and its own characteristics. At the same time, in the core part, an interface is provided, and users can communicate with the kernel part through ioctr to guide the behavior of kernel drivers, such as how to create mappered device, the properties of these divece, and so on. The user space section of linux device mapper mainly includes the package device-mapper. These include dmsetup tools and libraries to help create and configure mappered device. These libraries are mainly abstract and encapsulate the interface to communicate with ioctr to facilitate the creation and configuration of mappered device. These libraries need to be called in multipath-tool 's program.
Dm-multipath.ko and dm.ko:dm.ko are device mapper drivers. It is the basis for implementing multipath. Dm-multipath is actually a target driver for dm.
Scsi_id: included in the udev package, which can be configured in multipath.conf to get the serial number of the scsi device. By the serial number, it can be judged that multiple paths correspond to the same device. This is the key to multipath implementation. Scsi_id uses the sg driver to send EVPD page80 or page83 inquery commands to the device to query the identity of the scsi device. However, some devices do not support EVPD's inquery command, so they cannot be used to generate multipath devices. However, scsi_id can be rewritten to virtualize an identifier for devices that cannot provide a scsi device identity, and output to standard output. When the multipath program creates a multipath device, it calls scsi_id to get the scsi id of the device from its standard output. When rewriting, you need to modify the return value of the scsi_id program to 0. Because in the multipath program, the straightforward is checked to determine whether the scsi id has been successfully obtained.
4. Configure multipath
The basic configuration script is as follows:
[root@localhost ~] # cat / etc/multipath.conf defaults {polling_interval 30 failback immediate no_path_retry queue rr_min_io 100 path_checker tur user_friendly_names yes} # SVC device {vendor "IBM" product "2145" path_grouping_policy group_by_prio prio_callout "/ sbin/mpath_prio_alua / dev/%n"}
Multipath basic operation command
# / etc/init.d/multipathd start # enable mulitipath service # multipath-F # Delete existing path # multipath-v2 # format path # multipath-ll # View multipath
If the configuration is correct, there will be more devices such as mpathbp1 in the / dev/mapper/ directory. With the fdisk-l command, you can see the disks created by multipath software, such as / dev/mapper/mpathbp1.
Format the hard disk
Execute fdisk-l and you can see that the storage has been identified successfully and the multipathing configuration is correct. The information is as follows:
[root@localhost] # fdisk-l. Disk / dev/mapper/mpathb: 2684.4 GB, 2684354560000 bytes 255heads, 63 sectors/track, 326354 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System / dev/mapper/mpathbp1 1267350 2147483647 + ee GPT.
From the above information, you can find that it is already in the partition format of GPT, and then you need to format the hard drive. If not, you need to perform the following steps:
1. New Partition
[root@localhost ~] # pvcreate / dev/mapper/mpathb [root@localhost ~] # parted / dev/mapper/mpathb GNU Parted 2.1 Using / dev/mapper/mpathbp1 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt # set the partition type to gpt (parted) mkpart extended 0% # expand the partition and use the entire hard disk (parted) quit # to exit Information: You may need to update / etc/fstab.
two。 Format & mount the hard disk
[root@localhost ~] # mkfs.ext4 / dev/mapper/mpathbp1 [root@localhost ~] # mount / dev/mapper/mpathbp1 / test
After the mount is successful, it is ready for use.
3. Dynamic mount partition
When a new partition is created in the system, because the mount mount will fail after rebooting the system, you need to write the partition information to the / etc/fstab file for permanent mount.
[root@localhost ~] # vi / etc/fstab / dev/mapper/mpathbp1 / test ext4 defaults 1 2
Save and exit, and / dev/mapper/mpathbp1 will be automatically mounted to the / test directory after restart
At this point, I believe you have a deeper understanding of the "mount method of multi-path high-capacity hard disk under CentOS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.