Checking for non-msdos disklabels and non-GPT partition table layouts
To validate whether the target disk device contains an unsupported partition table layout:
- Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910).
- Identify the disk device in question from the log messages. For more information, see Identifying disks when working with VMware ESX (1014953).
For example:
/vmfs/devices/disks/vml.0200030000600508b30093fcf0a05b5b8cc739002f4d5341313531
- Use the
fdisk
command to display the current partition table on the device.
Note: In ESXi 5.x, you must use partedUtil to get partition information. For more information, see Using the partedUtil command line utility on ESXi and ESX (1036609)
Using fdisk, run the command:
# fdisk -l "/vmfs/devices/disks/DeviceName"
The output appears similar to:
Disk /vmfs/devices/disks/DeviceName: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/vmfs/devices/disks/DeviceName 1 66 524287+ ee EFI GPT
- Make note of the Id and System values (highlighted in red). Depending on the value of these fields, the ESX/ESXi host may not be able to understand the contents of the disk device, and refuse to make any changes. To allow the host to make any modifications to this volume, the volume must have an msdos partition or no partition at all.
Changing the partition type in the ESX Service Console using the parted utility
The command line utility parted
can be used in the ESX Service Console to change the disk label and partitioning scheme for a specific device.
Warning: This process will destroy data on the target device. The steps outlined here are potentially hazardous for your environment if they are not followed exactly. If you are not comfortable performing these steps, contact VMware Technical Support and work with them to resolve the issue.
To change the label and partitioning scheme using parted
:
- Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910).
- Identify the disk device in question from the log messages. For more information, see Identifying disks when working with VMware ESX (1014953). For example:
/vmfs/devices/disks/vml.0200030000600508b30093fcf0a05b5b8cc739002f4d5341313531
- Start the parted utility, specifying the disk device to be modified from step 2, using the command:
Note: In ESXi 5.x, you must use partedUtil to get partition information. For more information, see Using the partedUtil command line utility on ESXi and ESX (1036609).
# parted "/vmfs/devices/disks/DeviceName"
- At the
(parted)
prompt, display the current partition contents:
print
The output appears similar to:
Disk label type: gpt
Number Start End Size File system Name Flags
1 17.4kB 134MB 134MB Microsoft reserved partition msftres
- Review the output from the parted print command. Ensure that the disk device does not contain important information, either used by an ESX/ESXi host, a virtual machine as an RDM, or a physical server.
- To destroy all pre-existing partitions on the device and change the disk label, run the command:
mklabel
Caution: This operation deletes all pre-existing partitions on the device. The changes take effect immediately. This results in data loss and cannot be reverted.
- At the "
New disk label type? [label]
" prompt, enter the label:
msdos
- Repeat step 4 to validate that the partition table is blank, and the disk label has been changed to
msdos
.
- Exit parted using the command:
quit
- Retry the storage operation that was failing initially. If this method fails, use the dd utility instead.
Clearing partitioning information in ESXi using the DD utility
Due to differences between ESX classic and ESXi, the parted utility is not available in ESXi. These steps describe how to clear partitioning information for a LUN under ESXi.
Warning: This process will destroy data on the target device. The steps outlined here are potentially hazardous for your environment if they are not followed exactly. If you are not comfortable performing these steps, contact VMware Technical Support and work with them to resolve the issue.
- Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910).
- Identify the disk device in question from the log messages. For more information, see Identifying disks when working with VMware ESX (1014953). For example:
/vmfs/devices/disks/vml.0200030000600508b30093fcf0a05b5b8cc739002f4d5341313531
- Use the
fdisk
command to obtain the exact size of the target disk device in bytes:
Note: In ESXi 5.x, you must use partedUtil to get partition information. For more information, see Using the partedUtil command line utility on ESXi and ESX (1036609).
# fdisk -l "/vmfs/devices/disks/DeviceName"
The output appears similar to:
Disk /vmfs/devices/disks/DeviceName: 536 MB, 429491220480 bytes
255 heads, 63 sectors/track, 52216 cylinders, total 838850040 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/vmfs/devices/disks/DeviceName 1 128838850039 419424956 ee EFI GPT
- Use the dd command to erase the first 34 sectors (34x512 bytes) of the disk device with zeros:
# dd if=/dev/zero of="/vmfs/devices/disks/DeviceName" bs=512 count=34 conv=notrunc
Caution: This operation deletes the partition table and master boot record on the disk device. The changes take effect immediately. This results in data loss and cannot be reverted.
- The GPT partition scheme stores a backup of the partition table at the end of the disk device. Erase the last 34 sectors of the device as well:
- Determine the offset at which the last 34 sectors begins:
(SizeInBytes / 512) - 34 = SeekOffset
For example, using the values in step 3:
(429491220480 / 512) - 34 = 838850006
- Use the dd command to erase the last 34 sectors of the disk, starting at the offset found in step 5a:
# dd if=/dev/zero of="/vmfs/devices/disks/DeviceName" bs=512 count=34 seek=SeekOffset conv=notrunc
Caution: This operation deletes the partition table and master boot record on the disk device. The changes take effect immediately. This results in data loss and cannot be reverted.
- Depending on the original contents of the disk device, it may be necessary to erase a larger amount of data on the disk.
- Retry the storage operation.
Note: If your problem still exists after trying the steps in this article:
See also: