嘘~ 正在从服务器偷取页面 . . .

如何快速获取ESXi主机物理磁盘与NAA ID对应关系


通过此脚本可以查询出物理硬盘的NAA ID,Vendor,容量,型号,类型以及Slot位置信息。此脚本启源于客户的一个需求,客户有大规模的VMware vSAN集群,所有硬盘数量巨大。客户需要在VMware中快速通过NAA ID找到物理硬盘的位置。因此我为客户编写了此脚本文件。适用于HBA卡和RAID卡配置。

HBA卡输出:

此处适用于带有HBA适配器的vSAN环境中的磁盘信息收集。

[root@F0N1:/tmp] sh diskinfo.sh 
===========================================================Physical Disk Collection======================================================
| NAA ID                                    | Vendor          | Size       | Model            | Drive Type       | Physical Location    |
| ----------------------------------------- | --------------- | ---------- | ---------------- | ---------------- | -------------------- |
| naa.5000c500ec75c4d7                      | LENOVO          | 763097     | XS800ME70084     | physical         | enclosure 0 slot 1   |
| naa.5000c500ee744ba7                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 2   |
| naa.5000c500ee5ea2db                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 6   |
| naa.5000c500ee5f062b                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 7   |
| naa.5000c500ec7ae1bb                      | LENOVO          | 763097     | XS800ME70084     | physical         | enclosure 0 slot 0   |
| naa.5000c500ee757303                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 3   |
| naa.5000c500ee580763                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 5   |
| naa.5000c500ee60db57                      | LENOVO          | 2289272    | ST2400MM0129     | physical         | enclosure 0 slot 4   |
=========================================================================================================================================

RAID卡输出:

通过将脚本中 *esxcli storage core device physical get -d "$naa_id"* 修改为 *esxcli storage core device raid list -d <naa identifier device>*.

此处适用于RAID环境下的硬盘信息收集。

[root@FL16:/tmp] sh diskinfo.sh
===========================================================Physical Disk Collection======================================================
| NAA ID                                    | Vendor          | Size       | Model            | Drive Type       | Physical Location    |
| ----------------------------------------- | --------------- | ---------- | ---------------- | ---------------- | -------------------- |
| naa.600605b00bced1101f502d9da61ab3f1      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 4  |
| naa.600605b00bced1101f502dc5a879926d      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 9  |
| naa.600605b00bced1101f502d95a5a3b1ec      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 3  |
| naa.600605b00bced1101f502dbda8042542      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 8  |
| naa.600605b00bced1101f502d8da52844b4      | IBM             | 761985     | ServeRAID M5210  | logical          | enclosure 1, slot 0  |
| naa.600605b00bced1101f502da5a691be38      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 5  |
| naa.600605b00bced1101f502db5a780a0ad      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 7  |
| naa.600605b00bced1101f502dada708b8ec      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 6  |
| naa.600605b00bced1101f502d82a480ca81      | IBM             | 1143455    | ServeRAID M5210  | logical          | enclosure 1, slot 1  |
=========================================================================================================================================

下载链接


文章作者: kclouder
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 kclouder !
  目录