I had some spare Windows drives lying around and wanted to put them in my HP MicroServer running ESXi 4.1.
After installing the SATA drive, and rebooting, I tried to simply add the drive in the vSphere console. No love from VMWare â€” I got the message, â€œError while adding drive – disk not available.â€ Hmmm. I was sure the drive was working.
Turns out that in ESXi, once a disk has been written to, in any format, it wonâ€™t initialize.
Hereâ€™s what it took to add the drive in:
Low-level formatted the drive (the name of the drive might be shorter or longer):
~ # dd if=/dev/zero of=/vmfs/devices/disks/t10.ATA_ST3500413AS_Z2A3TKQ6 bs=512 conv=notrunc
Try adding the disk to your datastore now; I canceled this command after waiting 5 minutes and noticed that ESXi now saw the disk as a ‘blank disk’. Adding it to my datastore now worked! If not, continue…
Recreate the partition table:
~ # fdisk /vmfs/devices/disks/t10.ATA_ST3500413AS_Z2A3TKQ6
Then â€˜oâ€™ to Create a new empty DOS partition table
Then â€˜nâ€™ to add a new partition. I used Primary as the type, and 1 as the partition number.
Then â€˜tâ€™ to change the type. â€˜fbâ€™ is the code for VMFS 3.0
Then â€˜wâ€™ to write everything to the drive
Finally, use the â€˜vmkfstoolsâ€™ program to create the volume. I added it as a new datastore using the following command:
~ # vmkfstools -C vmfs3 -S Datastore2 /vmfs/devices/disks/t10.ATA_ST3500413AS_Z2A3TKQ6
As always, YMMV.