Error adding datastores to ESXi resolved using partedUtil

Print Friendly

UPDATE Sept 2015 – there is new functionality in the vSphere Web Client (v6.0u1) that allows you to delete all partitions – good info via William Lam’s website. Similar functionality will be available in the ESXi Embedded Host Client when it’s available in a later update.

UPDATE March 2015 – some people are hitting a similar issue when trying to reuse disks previously used by VSAN. The process below may still work but there are a few other things to check, as detailed here by Cormac Hogan.

Over the Christmas break I finally got some time to upgrade my home lab. One of my tasks was to build a new shared storage server and it was while installing the base ESXi (v5, build 469512) that I ran into an issue. I was unable to add any of the local disks to my ESXi host as VMFS datastores as I got the error “HostDatastoreSystem.QueryVmfsDatastoreCreateOptions” for object ‘ha-datastoresystem’ on ESXi….” as shown below;

The VI client error when adding a new datastore

I’d used this host and the same disks previously as an ESX4 host so I knew hardware incompatibility wasn’t an issue. Just in case I tried VMFS3 (instead of VMFS5) with the same result. I’ve run into a similar issue before with HP DL380G5’s where the workaround is to use the VI client connected directly to the host rather than vCentre. I connected directly to the host but got the same result. At this point I resorted to Google as I had a pretty specific error message. One of the first pages was this helpful blogpost at Eversity.nl (it’s always the Dutch isn’t it?) which confirmed it was an issue with pre-existing or incompatible information on the hard disks. There are various situations which might lead to pre-existing info on the disk;

  • Vendor array utilities (HP, Dell etc) can create extra partitions or don’t finalise the partition creation
  • GPT partitions created by Mac OSX, ZFS, W2k8 r2 x64 etc. Microsoft have a good explanation of GPT.

This made a lot of sense as I’d previously been trialling this host (with ZFS pools) as a NexentaStor CE storage server

The suggestion on the Eversity.nl site is to use ‘fdisk’ from an SSH session to delete the extraneous partitions. I gave that a try but it wouldn’t even list the disks, throwing an error about not being able to handle GPT disks;

fdisk can’t handle GPT partitions

There are various useful suggestions in the Eversity comments for dealing with GPT partitions but they are quite long winded. The quickest solution (as suggested by fdisk) was to use partedUtil.

You need to run the following command for each disk that you’re having issues with (this overwrites the partition table with a standard msdos one which VMware can work with);
NOTE: This will ERASE ALL DATA on the disk in question so be careful to select the right disks!

# partedUtil mklabel /dev/disks/<disk id> msdos

To get a list of your disks;

/dev/disks # ls

mpx.vmhba32:C0:T0:L0
mpx.vmhba32:C0:T0:L0:1
mpx.vmhba32:C0:T0:L0:5
mpx.vmhba32:C0:T0:L0:6
mpx.vmhba32:C0:T0:L0:7
mpx.vmhba32:C0:T0:L0:8
naa.5000c5001092762f
naa.50010b9000426a94
naa.50010b9000426a94:1
naa.50010b900042f244
naa.50010b900042f244:1
naa.5e83a97eca49476b
t10.ATA_____MAXTOR_STM3500320AS_________________________________9QM8XE4F
t10.ATA_____MAXTOR_STM3500320AS_________________________________9QM8XE4F:1
vml.0000000000766d68626133323a303a30
vml.0000000000766d68626133323a303a30:1
vml.0000000000766d68626133323a303a30:5
vml.0000000000766d68626133323a303a30:6
vml.0000000000766d68626133323a303a30:7
vml.0000000000766d68626133323a303a30:8
vml.010000000020202020202020202020202039514d38584534464d4158544f52
vml.010000000020202020202020202020202039514d38584534464d4158544f52:1
vml.02000000005000c5001092762f4d4158544f52
vml.020000000050010b9000426a94474e41303733
vml.020000000050010b9000426a94474e41303733:1
vml.020000000050010b900042f244474e41303733
vml.020000000050010b900042f244474e41303733:1
vml.02000000005e83a97eca49476b4f435a2d4147

/dev/disks #

As you can see from the above output, several of my GPT disks had extra partitions (indicated by the :1 on the end of the disk name). During relabelling these extra partitions will automatically be destroyed. The ‘.vml’ entries are simply symbolic links to the actual disks so you don’t need to run the command against those.

When you’ve finished you can go back to the VI client and add the disks successfully, no reboots required.

52 thoughts on “Error adding datastores to ESXi resolved using partedUtil

  1. I could use some help. I have ESXi 5 installed on a SD card. I have three drives in a raid 5 setup.

    Here’s my current output:

    ~ # ls /dev/disks/
    mpx.vmhba32:C0:T0:L0
    mpx.vmhba32:C0:T0:L0:1
    mpx.vmhba32:C0:T0:L0:5
    mpx.vmhba32:C0:T0:L0:6
    mpx.vmhba32:C0:T0:L0:7
    mpx.vmhba32:C0:T0:L0:8
    naa.600508b1001c24049a8f0a9a5bc77cf5
    vml.0000000000766d68626133323a303a30
    vml.0000000000766d68626133323a303a30:1
    vml.0000000000766d68626133323a303a30:5
    vml.0000000000766d68626133323a303a30:6
    vml.0000000000766d68626133323a303a30:7
    vml.0000000000766d68626133323a303a30:8
    vml.0200020000600508b1001c24049a8f0a9a5bc77cf54c4f47494341

    When I try:
    ~ # partedUtil mklabel /vmfs/devices/disks/naa.600508b1001c24049a8f0a9a5bc77cf5 msdos

    I get the error:

    Error: Function not implemented during read on /dev/disks/naa.600508b1001c24049a8f0a9a5bc77cf5
    Error: Function not implemented during write on /dev/disks/naa.600508b1001c24049a8f0a9a5bc77cf5
    WriteNewPtable: Unable to commit to device /vmfs/devices/disks/naa.600508b1001c24049a8f0a9a5bc77cf5

    What Am I doing wrong? Thanks.

  2. Brought an existing datastore back online and repeated the partedUtil mklabel command and it worked this time. Oh well.

    1. hey nick, How’d you restore an existing datastore? All my VMs on mine are gone due to this error after a power outage. The storage system is FreeNAS over FiberChannel.

  3. Attempted using this and the delete command, both result in
    /dev/disks # partedUtil mklabel “/vmfs/devices/disks/t10.ATA_____WDC_WD1502FAEX2D007BA0________________________WD2DWMAY03053012” msdos
    Error: Read-only file system during write on /dev/disks/t10.ATA_____WDC_WD1502FAEX2D007BA0________________________WD2DWMAY03053012
    WriteNewPtable: Unable to commit to device /vmfs/devices/disks/t10.ATA_____WDC_WD1502FAEX2D007BA0________________________WD2DWMAY03053012

    Any help appreciated.

  4. I had an HP P800 with a new created mirror disk that was giving this error. partedUtil fixed the problem for me.

  5. Thank you, your partedUtil command did the trick.

    However, I had another issue I am hoping you can shed some insight into.
    When I tried the /dev/disks # ls, I get a Permission denied.
    I have ssh and shell enabled. Any thoughts?
    Nick

  6. Problem solved:
    create RAID10 by starting server and pressing Ctrl+R (may differ)
    AND press Initialize RAID command. All working without problem.
    Before that got the same message when adding datastore >2 TB on wmfs-5

    1. Can you clarify how you did this Kev? Did you remove the physical disk and put it in a Windows server? If so that seems more long winded than running a single command line….

  7. We simply put a Windows Server 2012 DVD (any version of Windows server should work, or even a Windows 7/8 installatio DVDs) into the server, booted it, and started the wizard as though we were going to install Windows Server 2012. When it got to the point where we were asked which hard disk we’d like to install to, we used the “Customise” option. At this point the installation wizard shows you the available disks and the partitions. You can select the partitions on screen and click “Delete” to remove any that are left until the drive just shows as “Unallocated space”. At this point, cancel the Windows server installation, eject the disk, boot back into VMWare ESXi and we found it would then let us create a data store without any issues.

    We tried using command line as per your guide above but we ran into issues with permissions as per some of the other comments above (even when using the root account). Only realised we could probably delete the partitions using a Windows installation DVD after spending a lot of time trying to get the command to work. Hope this helps others who have trouble using the command above. Thanks for the guide though, it’s very comprehensive.

  8. Hey! This worked for me in ESXi 6 too! Had a linux partitioned drive that I was trying to repurpose. Certainly didn’t think it’d be any problem until I got the error message!

    Thanks so much for making the guide, it was a quick process – easy to follow and got me up and running in about 2 min!

  9. You are a genius!!
    It worked for ESXi 5 with the following command:
    partedUtil mklabel “/vmfs/devices/disks/vml.XXXYYZZ” msdos

    Thank you!!

    Luis

  10. Hi,

    maybe I found even better method to solve a problem. I receive this annoying message when try to add VMFS5 formatted datastore. Then I add the same disk as VMFS3 without any problems. So the next step are – deleting this new VMFS3 datastore and adding again as VMFS5 without any problems.
    🙂

  11. Once I identified the disk identifier but going through the process to create the Datastore. I then enabled SSH on the ESXi server under “Troubleshooting Mode Options” and then use “Putty” to connect to the ESXi server command line. Ran the command you suggested and it woke perfectly! Thanks!

  12. hi
    having the same problem with adding a new data store … im a newbie when it comes using VMware .. is there like a manual or step by step instruction starting from how to use Parted Util? thanks

    1. The Parted utility isn’t a VMware tool, it’s a generic tool. It’s been a while since I first looked at this so I’d suggest using Google to find a quick tutorial – there should be lots of help available.

  13. I’ve unfortunately afraid that I’ve lost my datastore and VMs after a power outage. It won’t recognize the VMFileSystem5 partition on the disk and it gives me the OPs error. Anyone know how to trick it into giving me access? 🙁 Would really really appreciate it.

    Storage system is FreeNAS iSCSI over P2P FiberChannel

    Thanks everyone

  14. I spent hours on this one until i found your post – thank you very much for sharing this! Saved some angry shouting and banging 🙂

  15. I ended up booting ubuntu server in rescue mode and using “dd if=/dev/zero of=/dev/foo bs=65536 count=65536” to zero out the disks, I couldn’t persuade vsphere/vcenter to understand that I wanted to reuse the disks for something else.

    am using ESX 6.0u2

  16. Awesome, thank you for the help! I knew it was a partition/format issue, but didn’t want to remove the disk or boot with some recovery CD. The command for partedUtil helped ALOT. 😀

    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *