ESXi 手动删除磁区
某些时候你将磁碟加入成为DataStore时,可能会出现错误:
A specified parameter was not correct. vm.Host.DiskPartitionInfo.spec ... ...
意指你加入的磁碟可能已经有其他分割无法进行删除成为DataStore,会有这状况可能是ESXi使用fdisk指令来管理磁碟,在你的分割是GPT或是fdisk本身无法管理的都会出现类似的错误,所以你必需要使用其他指令进行手动删除。
partedUtil
使用ssh登入ESXi Server时,执行partedUtil
不加参数会出现指令的使用方法:
Usage: Get Partitions : get <diskName> Set Partitions : set <diskName> ["partNum startSector endSector type attr"]* Delete Partition : delete <diskName> <partNum> Resize Partition : resize <diskName> <partNum> <start> <end> Get Partitions : getptbl <diskName> Set Partitions : setptbl <diskName> <label> ["partNum startSector endSector type/guid attr"]* Fix Partition Table : fix <diskName> Create New Label (all existing data will be lost): mklabel <diskName> <label> Show commonly used partition type guids : showGuids Get usable first and last sectors : getUsableSectors <diskName> Fix GPT Table interactively : fixGpt <diskName>
稍后会使用Delete Partition : delete <diskName> <partNum>
进行删除。
寻找磁区
删除磁区前首先寻找该磁区的磁碟名称:
ls -l /vmfs/devices/disks
所以与磁碟、磁区有关的都会在disks
这目录内,使用ls -l
列出很多资讯
total 4896061644 -rw------- 1 root root 1978895695872 May 16 15:52 mpx.vmhba1:C0:T0:L0 -rw------- 1 root root 1978894630400 May 16 15:52 mpx.vmhba1:C0:T0:L0:1 -rw------- 1 root root 7849115648 May 16 15:52 mpx.vmhba32:C0:T0:L0 -rw------- 1 root root 4161536 May 16 15:52 mpx.vmhba32:C0:T0:L0:1 -rw------- 1 root root 262127616 May 16 15:52 mpx.vmhba32:C0:T0:L0:5 -rw------- 1 root root 262127616 May 16 15:52 mpx.vmhba32:C0:T0:L0:6 -rw------- 1 root root 115326976 May 16 15:52 mpx.vmhba32:C0:T0:L0:7 -rw------- 1 root root 299876352 May 16 15:52 mpx.vmhba32:C0:T0:L0:8 -rw------- 1 root root 107374182400 May 16 15:52 naa.600140501e76a67dcf27d3813d82ded1 -rw------- 1 root root 107373116928 May 16 15:52 naa.600140501e76a67dcf27d3813d82ded1:1 -rw------- 1 root root 60022480896 May 16 15:52 t10.ATA_____EZLINK_Seraphim_MLC_60GB________________201203071200279_____ -rw------- 1 root root 60020490240 May 16 15:52 t10.ATA_____EZLINK_Seraphim_MLC_60GB________________201203071200279_____:1 -rw------- 1 root root 256060514304 May 16 15:52 t10.ATA_____EZLINK_T34_256GB________________________201410300108________ -rw------- 1 root root 256051917824 May 16 15:52 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:1 -rw------- 1 root root 40019582464 May 16 15:52 t10.ATA_____INTEL_SSDSA2M040G2GC____________________CVGB00330014040GGN__ -rw------- 1 root root 4161536 May 16 15:52 t10.ATA_____INTEL_SSDSA2M040G2GC____________________CVGB00330014040GGN__:1 -rw------- 1 root root 4293918720 May 16 15:52 t10.ATA_____INTEL_SSDSA2M040G2GC____________________CVGB00330014040GGN__:2 -rw------- 1 root root 34781265920 May 16 15:52 t10.ATA_____INTEL_SSDSA2M040G2GC____________________CVGB00330014040GGN__:3
以t10.
开头的主要是你机器上的磁碟,以例子中要找的是EZLINK T34这个256GB SSD,它先前在windows使用过,所以要进行手动删除才能成为DataStore,重新执行指令将所有EZLINK T34的都列出来:
ls -l /vmfs/devices/disks/t10.ATA_____EZLINK_T34_256GB*
列出相关的:
-rw------- 1 root root 256060514304 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________ -rw------- 1 root root 367001600 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:1 -rw------- 1 root root 255158087168 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:2 -rw------- 1 root root 532676608 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:3 /dev/disks # ls -l t10.ATA_____EZLINK_T34*
其他名称后面以:
冒号与数字组合的名称为磁区,以这个列表看来总共分割成3个磁区,现在要一一的将三个磁区删除。
删除磁区
承上已经列出要删除磁碟资讯:
t10.ATA_____EZLINK_T34_256GB________________________201410300108________ -rw------- 1 root root 367001600 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:1 -rw------- 1 root root 255158087168 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:2 -rw------- 1 root root 532676608 May 16 15:16 t10.ATA_____EZLINK_T34_256GB________________________201410300108________:3
此时利用partedUtil的Delete Partition : delete <diskName> <partNum>
进行删除:
cd /vmfs/devices/disks
partedUtil delete "t10.ATA_____EZLINK_T34_256GB________________________201410300108________" 3 partedUtil delete "t10.ATA_____EZLINK_T34_256GB________________________201410300108________" 2 partedUtil delete "t10.ATA_____EZLINK_T34_256GB________________________201410300108________" 1
以上执行正确后,重新再查看一下时,应该会看到只剩磁碟名称:
ls -l /vmfs/devices/disks/t10.ATA_____EZLINK_T34_256GB*
结果:
-rw------- 1 root root 256060514304 May 16 16:04 /vmfs/devices/disks/t10.ATA_____EZLINK_T34_256GB________________________201410300108________
确定删除后就可以利用vSphere Client进行重新加入成为DataStore的动作。
参考资讯
来上电脑课!- PartedUtil VMware ESXi 磁区管理指令
Vim.Host.DiskPartitionInfo.spec – VMware can’t add extra drive.