Error adding datastores to ESXi resolved using partedUtil

Print Friendly, PDF & Email

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 (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 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


/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.

65 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/

    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. Wow, thank you so much for posting this. I was getting so upset with this and finally resulted to google. Awesome! Thanks, this fixed my issue.

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

  6. 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?

  7. 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

  8. Why not just use a Windows Server disk to delete the partitions? We just did and it saved hours of problems!

    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….

  9. 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.

  10. 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!

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

    Thank you!!


  12. Thanks for this. Your instructions are infinitely better than the actual VMWAre documentation (which is sorely lacking)

    Anyway, just writing to thank you, from one developer to another

  13. 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.

  14. 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!

  15. 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.

  16. 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

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

  18. 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

  19. 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. 😀


  20. Edward, I am getting the following error message while trying to perform the same steps.

    Error: Connection timed out during write on /dev/disks/naa.600c0ff000db109c8c5a545801000000
    WriteNewPtable: Unable to commit to disk

    please help me to resolve the issue. thanks in advance.

    1. Sounds like something is still using the disk – active files will likely block an attempt to overwrite data. Try booting from a separate disk (a live Linux CD or similar) and try again.

  21. Hey Ed,

    Great write up short and sweet unlike the vmware kb.

    Many thanks got my 2nd logical partion added as a data store in minutes thanks to this. Much appreciated.

  22. Was getting similiar error message in home lab.. My issue turned out to be Jumbo Frames. I had JF enabled on VMKernal but not on Physical Switch.. After disabling JF – I was able to add disks without any issues.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.