VMware Cloud Community
albanperrin
Contributor
Contributor

vim-cmd vmsvc/device.diskadd syntax headaches

Hi all,

I must add a hard drive on a VM on 45 ESXi (3.5 U4) servers. All ESXi servers are free licenced, so i use the vim-cmd command via ssh.

I use that set off command a lot, but i can't find the good syntax for the vim-cmd vmsvc/device.diskadd command.

The default output help is like that : "device.diskadd vmid size controller number unit number datastore"

  • The "vmid" parameter is OK

  • I don't know the default unit for the "size" parameter (Go ?) but i'll guess it once my command line will execute right

  • For the "controller" parameter, i've tryed "scsi0", and i think it's ok

  • For the first(!)* "number" parameter, i guess that it address the scsi id, an integer value seems to be ok

  • I'm lost for the last 3 parameters : "unit" / "number" / "datastore"

I even wonder if the parameter "unit" is not a mistake (i thought that reading on this forum another example : http://communities.vmware.com/message/1137366)

Of course, i googled my problem a lot, i've read few guides that give a review off the vim-cmd (or vmware-vim-cmd etc) toolbox, but i've never found an example with the command "device.diskadd" (just found one example with the command device diskremove that helped me with the "controller" parameter).

Someone plz could help me ? (i would be eternally greatfull ^^)

thx for reading that and plz forgive my awful english 😐

Reply
0 Kudos
2 Replies
albanperrin
Contributor
Contributor

Posting often helps to think...

I think the command is waiting for 5 parameters (not 7...)

the command syntax help would be more helpfull displayed like that :

device.diskadd vmid size "controller number" "unit number" datastore

But i'm still stuck...

I'm tryin' something like that :

vim-cmd vmsvc/device.diskadd 16 10 scsi0 2 datastore1

"16" is the vmid, 10 is the size of the new disk, scsi0 is the "controller number", 2 is the "unit number" and datastore1 is the name of my local datastore (the default one).

When i execute that command line, i have no error message on the shell, but the Vi Client reports me that in the Events pan :

Failed to create virtual disk /vmfs/volumes/<id_of_my_datastore>/<directory_of_my_vm/disk_of_my_vm_2.vmdk

And in the Recent Tasks pan (the one on the bottom of the Vi Client reports me :

(Name) Reconfigure virtual machine (Target) the right VM (Status) A specified parameter was not correct (Initiated by) root

Maybe my syntax is now correct ? (because the message in the event pan tries to create new hard drive where i want to, but it fails). But, the 'recent task pan' mentions a wrong parameter...

It's not because the vmfs volume is full, i'm looking at some rights problems (but... the command is initiated by root who can create a file where i try to add a .vmdk, it of course also be able to append vm config files...)

Still trying to solve that. Any help appreciated ^^

( Edit : It's not either a number of device restriction since i've succeeded to add a hard drive via the Vi Client)

Reply
0 Kudos
albanperrin
Contributor
Contributor

At least... i solved my issue.

The syntax was right, but... the unit for the expected size of hard drive to create is in KB... So create a disk of 5 or 10KB can't be possible.

To create and hot plug a 5GB disk :

vim-cmd vmsvc/device.diskadd 16 5242880 scsi0 2 datastore1