mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
Merge pull request #30051 from wxy/20230816-How-to-find-SAN-LUN-Mapped-to-VxVM-Disk-in-Linux.md
ATRP:published/20230816 How to find SAN LUN Mapped to VxVM Disk in Linux.md
This commit is contained in:
commit
cd544b4ef8
@ -3,14 +3,16 @@
|
||||
[#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-16164-1.html"
|
||||
|
||||
如何在 Linux 中查找映射到 VxVM 磁盘的 SAN LUN
|
||||
======
|
||||
|
||||
我们过去写过几篇文章来查找映射到块设备/磁盘的 LUN ID,但是当你管理 **[VCS 集群][1]**时,在某些情况下你可能需要映射 LUN 用于 VxFS 文件系统扩展的 VxVM (Veritas Volume Manager) 磁盘的 ID。
|
||||
![][0]
|
||||
|
||||
我们过去写过几篇文章来查找映射到块设备/磁盘的 LUN ID,但是当你管理 [VCS 集群][1]时,在某些情况下你可能需要映射 LUN 用于 VxFS 文件系统扩展的 VxVM(Veritas 卷管理器)磁盘的 ID。
|
||||
|
||||
这篇短文介绍了如何在 Linux 中查找与 VxVM 磁盘关联的 LUN 号。
|
||||
|
||||
@ -21,63 +23,56 @@
|
||||
* **[如何在 Linux 中映射 SAN LUN、磁盘和文件系统][4]**
|
||||
* **[如何在 Linux 中映射 LUN、磁盘、LVM 和文件系统][5]**
|
||||
|
||||
|
||||
|
||||
### 在 Linux 中查找映射到 VxVM 磁盘的 LUN 号的 Shell 脚本
|
||||
|
||||
这个方便的 shell 脚本可帮助你识别哪个存储 LUN 与 Linux 上的哪个 VxVM 磁盘关联。
|
||||
这个方便的 Shell 脚本可帮助你识别哪个存储 LUN 与 Linux 上的哪个 VxVM 磁盘关联。
|
||||
|
||||
#### 这个脚本是如何工作的
|
||||
|
||||
该脚本按照以下步骤收集和打印这些信息。
|
||||
|
||||
* 它收集系统上活动**“磁盘组”(DG)**的列表
|
||||
* 查找与相应 DG 关联的**“设备名称”**。
|
||||
* 接下来,它列出了与各个设备映射的**“块设备”**。
|
||||
* 它收集系统上活动 “磁盘组”(DG)的列表
|
||||
* 查找与相应 DG 关联的 “设备名称”。
|
||||
* 接下来,它列出了与各个设备映射的 “块设备”。
|
||||
* 最后收集与这些块设备关联的 **LUN ID** 并将它们全部打印在一起,如 DG 名称、块设备名称和 LUN 编号。
|
||||
|
||||
|
||||
|
||||
```
|
||||
vi VxVM_disk_mapping_with_LUN_number.sh
|
||||
```
|
||||
|
||||
vi VxVM_disk_mapping_with_LUN_number.sh
|
||||
```
|
||||
#!/bin/bash
|
||||
###########################################################
|
||||
# Purpose: Mapping LUN Number to VxVM Disk in Linux
|
||||
# Author: 2DayGeek
|
||||
# Version: v1.0
|
||||
###########################################################
|
||||
|
||||
#!/bin/bash
|
||||
###########################################################
|
||||
# Purpose: Mapping LUN Number to VxVM Disk in Linux
|
||||
# Author: 2DayGeek
|
||||
# Version: v1.0
|
||||
###########################################################
|
||||
|
||||
echo "DG_Name Block_Device LUN_Number"
|
||||
echo "-------------------------------------------------------------------"
|
||||
for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME`
|
||||
echo "DG_Name Block_Device LUN_Number"
|
||||
echo "-------------------------------------------------------------------"
|
||||
for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME`
|
||||
do
|
||||
for d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}'
|
||||
do
|
||||
for b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1`
|
||||
do
|
||||
for d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}'
|
||||
do
|
||||
for b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1`
|
||||
do
|
||||
echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'"
|
||||
done
|
||||
done
|
||||
done | column -t
|
||||
echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'"
|
||||
done
|
||||
done
|
||||
done | column -t
|
||||
|
||||
```
|
||||
|
||||
设置shell脚本文件的可执行权限。
|
||||
设置 Shell 脚本文件的可执行权限。
|
||||
|
||||
```
|
||||
|
||||
chmod +x VxVM_disk_mapping_with_LUN_number.sh
|
||||
|
||||
chmod +x VxVM_disk_mapping_with_LUN_number.sh
|
||||
```
|
||||
|
||||
最后执行脚本查看结果。
|
||||
|
||||
```
|
||||
|
||||
sh VxVM_disk_mapping_with_LUN_number.sh
|
||||
|
||||
sh VxVM_disk_mapping_with_LUN_number.sh
|
||||
```
|
||||
|
||||
你的输出将类似于此。但是,DG 名称、块设备和 LUN 会与此不同。
|
||||
@ -87,23 +82,25 @@
|
||||
如果你想即时运行上述脚本,请使用下面的单行脚本。
|
||||
|
||||
```
|
||||
|
||||
# for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME`; do for d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}'; do for b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1`; do echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'"; done; done; done | column -t
|
||||
|
||||
apachedg --> sde --> 3600d0230000000000e11404639558823
|
||||
apachedg --> sdf --> 3600d0230000000000e11404639558824
|
||||
apachedg --> sdg --> 3600d0230000000000e11404639558825
|
||||
sftpdg --> sdh --> 3600d0230000000000e11404639558826
|
||||
sftpdg --> sdi --> 3600d0230000000000e11404639558827
|
||||
|
||||
# for dg_name in `vxdg list | awk '{print $1}' | grep -v NAME`; do for d_name in `vxdisk -e list | grep -i $dg_name | awk '{print $1}'; do for b_device in `vxdisk list $d_name | grep -w state=enabled | awk '{print $1}' | head -1`; do echo "$dg_name --> $b_device --> $(lsscsi --scsi | grep $b_device | awk '{print $NF}'"; done; done; done | column -t
|
||||
```
|
||||
|
||||
##### 总结
|
||||
```
|
||||
apachedg --> sde --> 3600d0230000000000e11404639558823
|
||||
apachedg --> sdf --> 3600d0230000000000e11404639558824
|
||||
apachedg --> sdg --> 3600d0230000000000e11404639558825
|
||||
sftpdg --> sdh --> 3600d0230000000000e11404639558826
|
||||
sftpdg --> sdi --> 3600d0230000000000e11404639558827
|
||||
```
|
||||
|
||||
在本教程中,我们向你展示了如何在 Linux 中查找与 VxVM (Veritas Volume Manager) 磁盘映射的 LUN 号。
|
||||
### 总结
|
||||
|
||||
在本教程中,我们向你展示了如何在 Linux 中查找与 VxVM 磁盘映射的 LUN 号。
|
||||
|
||||
如果你有任何问题或反馈,请随时在下面发表评论。
|
||||
|
||||
*(题图:MJ/251ada36-41d9-4a1b-b857-a1def52f27f2)*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/find-san-lun-mapping-with-vxvm-disk-veritas-linux/
|
||||
@ -111,7 +108,7 @@ via: https://www.2daygeek.com/find-san-lun-mapping-with-vxvm-disk-veritas-linux/
|
||||
作者:[Prakash Subramanian][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -123,3 +120,4 @@ via: https://www.2daygeek.com/find-san-lun-mapping-with-vxvm-disk-veritas-linux/
|
||||
[4]: https://www.2daygeek.com/map-san-lun-physical-disk-filesystem-linux/
|
||||
[5]: https://www.2daygeek.com/map-san-lun-physical-disk-filesystem-lvm-info-linux/
|
||||
[6]: https://www.2daygeek.com/wp-content/uploads/2023/07/find-san-lun-mapping-with-vxvm-disk-veritas-linux-1024x298.jpg
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202309/06/145937qzio9bi65iq6uozu.jpg
|
Loading…
Reference in New Issue
Block a user