如果在vSphere Client里面添加已经安装过操作系统的磁盘(如安装过Windows系统的磁盘),那是无法再直接添加驱动器的,需要SSH登录到ESXi的控制台进行操作。
获取磁盘设备信息:
# esxcfg-scsidevs -l
mpx.vmhba32:C0:T0:L0
Device Type: Direct-Access
Size: 7580 MB
Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
Multipath Plugin: NMP
Console Device: /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0
Devfs Path: /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0
Vendor: HP iLO Model: Internal SD-CARD Revis: 2.09
SCSI Level: 2 Is Pseudo: false Status: on
Is RDM Capable: false Is Removable: true
Is Local: true Is SSD: false
Other Names:
vml.0000000000766d68626133323a303a30
VAAI Status: unsupported
t10.ATA_____PLEXTOR_PX2D128M5S_______________________P02349103954________
Device Type: Direct-Access
Size: 122104 MB
Display Name: Local ATA Disk (t10.ATA_____PLEXTOR_PX2D128M5S_______________________P02349103954________)
Multipath Plugin: NMP
Console Device: /vmfs/devices/disks/t10.ATA_____PLEXTOR_PX2D128M5S_______________________P02349103954________
Devfs Path: /vmfs/devices/disks/t10.ATA_____PLEXTOR_PX2D128M5S_______________________P02349103954________
Vendor: ATA Model: PLEXTOR PX-128M5 Revis: 1.05
SCSI Level: 5 Is Pseudo: false Status: on
Is RDM Capable: false Is Removable: false
Is Local: true Is SSD: true
Other Names:
vml.01000000005030323334393130333935342020202020202020504c4558544f
VAAI Status: unknown
t10.ATA_____WDC_WD3200BEVT2D75ZCT2________________________WD2DWXE309HU6629
Device Type: Direct-Access
Size: 305245 MB
Display Name: Local ATA Disk (t10.ATA_____WDC_WD3200BEVT2D75ZCT2________________________WD2DWXE309HU6629)
Multipath Plugin: NMP
Console Device: /vmfs/devices/disks/t10.ATA_____WDC_WD3200BEVT2D75ZCT2________________________WD2DWXE309HU6629
Devfs Path: /vmfs/devices/disks/t10.ATA_____WDC_WD3200BEVT2D75ZCT2________________________WD2DWXE309HU6629
Vendor: ATA Model: WDC WD3200BEVT-7 Revis: 11.0
SCSI Level: 5 Is Pseudo: false Status: on
Is RDM Capable: false Is Removable: false
Is Local: true Is SSD: false
Other Names:
vml.0100000000202020202057442d575845333039485536363239574443205744
VAAI Status: unknown
其中t10.ATA_____PLEXTOR_PX2D128M5S_______________________P02349103954________就是安装过Windows系统的硬盘,获取它的分区信息:
~ # partedUtil get /vmfs/devices/disks/t10.ATA_____PLEXTOR_PX2D128M5S___________
____________P02349103954________
15566 255 63 250069680
1 2048 718847 7 128
2 718848 250069646 7 0
删除分区:
~ # partedUtil delete /vmfs/devices/disks/t10.ATA_____PLEXTOR_PX2D128M5S________
_______________P02349103954________ 1
~ # partedUtil delete /vmfs/devices/disks/t10.ATA_____PLEXTOR_PX2D128M5S________
_______________P02349103954________ 2
删除完成后再到vSphere Client里面重新添加磁盘即可。
附esxcfg-scsidevs的用法:
~ # esxcfg-scsidevs -h
esxcfg-scsidevs <options>
Print the mappings between vmhba names and /dev names
-l|--list List all Logical Devices known on this
system with device information.
-c|--compact-list List all Logical Devices each on a
single line, with limited information.
-u|--uids List all Device Unique Identifiers with their primary name.
-d|--device Used to filter the --list, --compact-list
and uids commands to limit output to a
specific device.
-m|--vmfs Print mappings for VMFS volumes to their
Service Console partitions and vmhba names.
-f|--vfat Print mappings for VFAT volumes to their
Service Console partitions and vmhba names.
-a|--hbas Print HBA devices with identifying information
-A|--hba-device-list Print a mapping between HBAs and the devices it
provides paths to.
-o|--offline-cos-dev Offline the COS device corresponding to this vmkernel
device.
-n|--online-cos-dev Bring online the COS device corresponding to this vmkernel
device.
-h|--help Show this message.
partedUtil工具的用法:
~ # partedUtil -h
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>