设备映射器多路径与 kpartx

设备映射器多路径与 kpartx

模式:Debian 10 上的 Linux 服务器连接到 2 个 SAN 结构,我从 HPE MSA 2060 中提供了 3 个 LUN。

任务:为所呈现的 LUN 正确设置多路径,我是否需要在多路径 -i 命令 kpartx 之后使用?

multipath -i 
kpartx -a -p p /dev/mapper/3600c0ff00064ed6d06567f6401000000-part1
mkfs.ext4 -E nodiscard /dev/mapper/3600c0ff00064ed6d06567f6401000000p1
mount -t ext4 -o discard /dev/mapper/3600c0ff00064ed6d06567f6401000000p1 /mnt/

或者

# set up presented LUN to device mapper multipath
multipath -i 
mkfs.ext4 -E nodiscard /dev/mapper/3600c0ff00064ed6d06567f6401000000
mount -t ext4 -o discard /dev/mapper/3600c0ff00064ed6d06567f6401000000 /mnt/

我做什么

  • 对于一个 LUN(仅使用多路径 -i、mkfs、mount)
  • 对于第二个 LUN (多路径 -i、kpartx、mkfs、mount)
multipath -i
5000.295630 | 3600c0ff00064ed6d06567f6401000000: addmap [0 390619136 multipath 0 1 alua 8 1 service-time 0 1 1 8:80 1 service-time 0 1 1 65:16 1 service-time 0 1 1 65:144 1 service-time 0 1 1 66:16 1 service-time 0 1 1 8:144 1 service-time 0 1 1 8:208 1 service-time 0 1 1 65:80 1 service-time 0 1 1 65:208 1]
create: 3600c0ff00064ed6d06567f6401000000 undef HPE,MSA 2060 FC
size=186G features='0' hwhandler='1 alua' wp=undef
|-+- policy='service-time 0' prio=50 status=undef
| `- 15:0:0:2 sdf  8:80   undef ready running
|-+- policy='service-time 0' prio=50 status=undef
| `- 15:0:3:2 sdr  65:16  undef ready running
|-+- policy='service-time 0' prio=50 status=undef
| `- 16:0:1:2 sdz  65:144 undef ready running
|-+- policy='service-time 0' prio=50 status=undef
| `- 16:0:3:2 sdah 66:16  undef ready running
|-+- policy='service-time 0' prio=10 status=undef
| `- 15:0:1:2 sdj  8:144  undef ready running
|-+- policy='service-time 0' prio=10 status=undef
| `- 15:0:2:2 sdn  8:208  undef ready running
|-+- policy='service-time 0' prio=10 status=undef
| `- 16:0:0:2 sdv  65:80  undef ready running
`-+- policy='service-time 0' prio=10 status=undef
  `- 16:0:2:2 sdad 65:208 undef ready running
multipath -ll
3600c0ff00064ed6d06567f6401000000 dm-5 HPE,MSA 2060 FC
size=186G features='0' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| `- 15:0:0:2 sdf  8:80   active ready running
|-+- policy='service-time 0' prio=50 status=enabled
| `- 15:0:3:2 sdr  65:16  active ready running
|-+- policy='service-time 0' prio=50 status=enabled
| `- 16:0:1:2 sdz  65:144 active ready running
|-+- policy='service-time 0' prio=50 status=enabled
| `- 16:0:3:2 sdah 66:16  active ready running
|-+- policy='service-time 0' prio=10 status=enabled
| `- 15:0:1:2 sdj  8:144  active ready running
|-+- policy='service-time 0' prio=10 status=enabled
| `- 15:0:2:2 sdn  8:208  active ready running
|-+- policy='service-time 0' prio=10 status=enabled
| `- 16:0:0:2 sdv  65:80  active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  `- 16:0:2:2 sdad 65:208 active ready running
kpartx -a -p p /dev/mapper/3600c0ff00064ed6d06567f6401000000
mkfs.ext4 -E nodiscard /dev/mapper/3600c0ff00064ed6d06567f6401000000p1
mkdir /mnt/MSA2060_TEST_LUN
mount -t ext4 -o discard /dev/mapper/3600c0ff00064ed6d06567f6401000000p1 /mnt/MSA2060_TEST_LUN
blkid /dev/mapper/3600c0ff00064ed6d06567f6401000000p1

写入UUID

nano /etc/fstab
mount -a

帮助理解如何正确使用多路径与 kpartx?

答案1

kpartx使用多路径存储时,您根本不需要使用。

如果我有一个可用的多路径设备......

$ multipath -l
mpatha (0QEMU_QEMU_HARDDISK_0001) dm-0 QEMU,QEMU HARDDISK
size=1.0G features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| `- 0:0:0:0 sda 8:0  active undef running
`-+- policy='service-time 0' prio=0 status=enabled
  `- 0:0:0:1 sdb 8:16 active undef running

我可以通过运行对磁盘进行分区fdisk /dev/mapper/mpatha,并且这些分区将像任何其他块设备一样被识别:

[root@localhost ~]# ls -l /dev/mapper/mpatha*
lrwxrwxrwx. 1 root root 7 Apr  2 04:10 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx. 1 root root 7 Apr  2 04:10 /dev/mapper/mpatha1 -> ../dm-1
lrwxrwxrwx. 1 root root 7 Apr  2 04:10 /dev/mapper/mpatha2 -> ../dm-2

相关内容