ESXiでHDDを使いまわすときのお作法

稼働中のESXiに今まで使ってたHDDを使いまわすにはちょっとお作法があります。
(はずす前にパーティションまっさらにしとけば、この手間はありませんが)

先ずは追加したHDDが認識されてるかどうかを確認します。
色々見えてますが、今回追加したのは、Western DigitalのWD2002FAEXなので
ちゃんとディスクとしては見えていますね。

~ # ls /vmfs/devices/disks/
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:1
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:2
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:3
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:5
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:6
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:7
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:8
t10.ATA_____INTEL_SSDSA2CW080G3_____________________CVPR113601A0080BGN__:9
t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556
t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556:1
t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556:2
t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556:3
t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556:4
vml.0100000000202020202057442d574d41593033303333353536574443205744
vml.0100000000202020202057442d574d41593033303333353536574443205744:1
vml.0100000000202020202057442d574d41593033303333353536574443205744:2
vml.0100000000202020202057442d574d41593033303333353536574443205744:3
vml.0100000000202020202057442d574d41593033303333353536574443205744:4
vml.010000000043565052313133363031413030383042474e2020494e54454c20
vml.010000000043565052313133363031413030383042474e2020494e54454c20:1
vml.010000000043565052313133363031413030383042474e2020494e54454c20:2
vml.010000000043565052313133363031413030383042474e2020494e54454c20:3
vml.010000000043565052313133363031413030383042474e2020494e54454c20:5
vml.010000000043565052313133363031413030383042474e2020494e54454c20:6
vml.010000000043565052313133363031413030383042474e2020494e54454c20:7
vml.010000000043565052313133363031413030383042474e2020494e54454c20:8
vml.010000000043565052313133363031413030383042474e2020494e54454c20:9
~ #

では、デバイス名がわかったので、今のパーティションテーブルを確認しましょう。
どうやら、4つ切られているようです。

~ # partedUtil getptbl "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0__
______________________WD2DWMAY03033556"
msdos
243201 255 63 3907029168
1 40 1060289 131 0
2 1060296 2120579 131 0
3 2120584 3906011969 131 0
4 3906011976 3907007999 131 0
~ #

ちなみに、それぞれの意味はこんな感じみたいです。(Thankyou! Google!!)

1 40 1060289 131 128
2 1060296 2120579 252 0
3 2120584 3906011969 5 0
4 3906011969 3907007999 251 0
| | | | |
| | | | \--- attribute
| | | \------- type
| | \------------------ ending sector
| \----------------------------- starting sector
\------------------------------- partition number


Linux - 0x83 = 131
Linux SWAP - 0x82 = 130
Linux LVM - 0x8e = 142
Linux RAID - 0xfd = 253

ここで、デバイス名が確認できましたんで、ばっさり消します。

~ # partedUtil delete "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0___
_____________________WD2DWMAY03033556" 1
~ # partedUtil delete "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0___
_____________________WD2DWMAY03033556" 2
~ # partedUtil delete "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0___
_____________________WD2DWMAY03033556" 3
~ # partedUtil delete "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0___
_____________________WD2DWMAY03033556" 4

さて・・・消えたかな?

~ # partedUtil getptbl "/vmfs/devices/disks/t10.ATA_____WDC_WD2002FAEX2D007BA0________________________WD2DWMAY03033556"
msdos
243201 255 63 3907029168

はい。きれいさっぱり消えましたw
(vCenterから消せたら、こんな面倒なことはしなくて良いんですけどね・・・・・)