Linux ISCSI multi-path Mount Storage
Preparations:
After the LUN is created, the lLUN is divided into independent groups, and the server's iqn information is added to the LUN. If it is placed in the default group, the hard disk information displayed during ISCSI scan is of all Luns, which may lead to misoperations.
Scan storage:
The ISCSI plug-in has been selected when installing the system. If not, you can use the local source or yum for installation.
[Root @ CLanguage] # service iscsi start # start the ISCSI service
[Root @ CLanguage] # chkconfig -- list | grep iscsi # Check whether the ISCSI service is started
[Root @ CLanguage] # iscsiadm-m discovery-t st-p 192.168.85.101: 3260 # scanning storage st is short for sendtargets
[Root @ CLanguage] # iscsiadm-m discovery-t st-p 192.168.85.102: 3260 # dual-link routing is required twice
Format: iscsiadm-m discovery-t st-p storage IP Address: Port Number br/> [root @ CLanguage] # reboot
[Root @ CLanguage] # iscsiadm-m node-T iqn.1992-01.com. lsi: 4981.60080e50002c4a0000000004f6fba42-p 192.168.85.101: 3260-l
[Root @ CLanguage] # iscsiadm-m node-T iqn.1992-01.com. lsi: 4981.60080e50002c4a0000000004f6fba42-p 192.168.85.101: 3260-l
# It takes two double links.
# Fdisk-l # view hard disk Information
Basic configuration of multipath in RedHat 6.2:
1. Run the command lsmod | grep dm_multipath to check whether the installation is successful. If no output instructions are provided, install the software package yum-y install device-mapper-multipath through the yum function.
Run the command: multipath-ll to check whether the module is successfully loaded.
[Root @ CLanguage] # yum-y install device-mapper-multipath
(No local source can be used for installation. If there is no network .)
[Root @ CLanguage] # multipath-ll
Mar 10 19:18:28 |/etc/multipath. conf does not exist, blacklisting all devices.
Mar 10 19:18:28 | A sample multipath. conf file is located
Mar 10 19:18:28 |/usr/share/doc/device-mapper-multipath-0.4.9/multipath. conf
Mar 10 19:18:28 | You can run/sbin/mpathconf to create or modify/etc/multipath. conf
Mar 10 19:18:28 | DM multipath kernel driver not loaded ---- the DM module is not loaded
If the module is not loaded successfully, use the following command to initialize the DM or restart the system.
--- Use the following commands to initialize and start DM for the first time:
[Root @ CLanguage] # modprobe dm-multipath
[Root @ CLanguage] # modprobe dm-round-robin
[Root @ CLanguage] # service multipathd start
[Root @ CLanguage] # multipath-v2
After initialization, run the multipath-ll command to check whether the file is successfully loaded.
[Root @ CLanguage] # multipath-ll
Mar 10 19:21:14 |/etc/multipath. conf does not exist, blacklisting all devices.
Mar 10 19:21:14 | A sample multipath. conf file is located
Mar 10 19:21:14 |/usr/share/doc/device-mapper-multipath-0.4.9/multipath. conf
Mar 10 19:21:14 | You can run/sbin/mpathconf to create or modify/etc/multipath. conf
DM multipath kernel driver not loaded ---- this prompt indicates that the DM module has been loaded successfully.
The above prompt shows that the DM module is successfully loaded, but there is no multipath. conf configuration file under/etc/. Next we will introduce how to configure the multipath. conf file.
2. Configure multipath:
Run the vi command to create a Multipath configuration file path:/etc/multipath. conf. Add the following configuration to the configuration file:
[Root @ CLanguage] # vi/etc/multipath. conf
Blacklist {
Devnode "^ sda"
}
Defaults {
User_friendly_names yes
Path_grouping_policy multibus
Failback immediate
No_path_retry fail
}
After editing, save the configuration and run the following command:
[Root @ CLanguage] #/etc/init. d/multipathd stop
[Root @ CLanguage] #/etc/init. d/multipathd start
[Root @ CLanguage] # multipath-ll
Mpatha (360a9800064665072444255634770000c) dm-0 NETAPP, LUN ---- creates a lun
Size = 3.5G features = '0' hwhandler = '0' wp = rw
-+-Policy = 'round-robin 0' prio = 4 status = active <br/> |-1: 0: 0: 0 sdb 8: 16 active ready running ---- two drive letters sdb and sde in multiple paths. <br/>-2: 0: 0: 0 sde 8: 64 active ready running
Two folders mpatha and mpathap1 are added to the/dev/mapper/directory.
[Root @ CLanguage] # cd/dev/mapper/
[Root @ CLanguage mapper] # ls
Control mpatha mpathap1
At the same time, the fdisk-l command also has two device identifiers:
Mapper # fdisk-l
Mapper # multipath-F # Delete two new paths from the existing path and the new paths will be deleted (not operated)
Mapper # multipath-v2 # format the path again (not operate)
3. Basic operations on a multipath Disk
You only need to operate the disks generated by the multi-path software on the disks in the/dev/mapper/directory. run the pvcreate command before partitioning the disk generated by the multi-path software:
[Root @ CLanguage] # pvcreate/dev/mapper/mpatha
[Root @ CLanguage] # use this directory for fdisk/dev/mapper/mpatha partitioning/dev/mapper/mpatha
N: Indicates creating a partition, p: indicates the primary partition, w: Indicates saving and exiting, and setting the disk size to + 30000 mb. When the disk is divided into one partition, press Enter.
If you use fdisk to partition and save a disk generated by the multi-path software, an error is returned. Ignore this error.
[Root @ CLanguage] # ls-l/dev/mapper/
Mpathap1 is the partition of the multipath disk.
[Root @ CLanguage] # mkfs. ext4/dev/mapper/mpathap1 # format the mpath1p1 partition into an ext4 File System
[Root @ CLanguage] # mount/dev/mapper/mpathap1/mnt/# mount the mpathap1 Partition
This article permanently updates link: https://www.bkjia.com/Linux/2018-02/151052.htm