0

Current Method

In the past I've done this by copying the ISOs to a Windows desktop then using the vCenter client to upload the ISO to a temporary datastore location on the ESXi server, then using "Datastore ISO file" to make the ISO available to the guest. This works, but requires multiple delays waiting for copies to complete, uses up more storage than necessary, and leads to situations where the extra copies get forgotten.

Background

The question Mounting ISO image on VMware ESX guest OS without VMware client is similar to this situation, except they were looking for a way to make an already-uploaded ISO connect to the VM.

Based on current VMware documentation, it appears that "esxcli" is the current preferred CLI. The older vicfg and esxcfg commands are deprecated.

So far, the closest I've found is a vmware-cmd that connects and disconnects the CD/DVD drive:

vmware-cmd /vmfs/volumes/storage1/MyVM/MyVM.vmx connectdevice "CD/DVD Drive 2"

If I can't find a better option, I could also use vicfg-advcfg (preferably preceded by a vicfg-cfgbackup in case something goes wrong) to change the CD/DVD path variable.

I have not found any CLI or API method that appears to let me upload a file to a datastore like the Windows/Web client does.

Restrictions

If necessary, I can also use the Python, Perl, or Ruby APIs from a Linux server. Installing PowerCLI for Linux might be tricky, but I'm not completely ruling it out.

I cannot use a direct ssh connection to the ESXi servers. There is not a shared NFS server where I could copy the ISOs and have both the Linux server and the vCenter farm accessing the same share.

Question

How can I make an ISO file local to a Linux server available to a VMware ESXi/vCenter guest using command line tools?

Steve Bonds
  • 1,014
  • 2
  • 12
  • 21

1 Answers1

0

Via a SAMBA share if it's an option.

Edit /etc/fstab to add that;

//hostname/share /mnt/smb smbfs noauto username=uname password=password 0 0

Create the directory;

mkdir /mnt/smb
mount /mnt/smb

Finaly you create a symbolic link in vmimages that point to the new share.

ln /mnt/smb /vmfs/vmimages/smb

IMO the first method is the best as all your ESX host can see the shared datastore, and thus moving a VM which as the iso mapped can't fail, but if you map the samba share to all your server you should be ok for that part.

yagmoth555
  • 16,758
  • 4
  • 29
  • 50
  • I'll keep this in mind, but currently the same NFS restriction would apply to SMB and it seems easier to turn an NFS share into an ESXi datastore than an SMB share. – Steve Bonds Dec 06 '18 at 19:18
  • 1
    @SteveBonds if you can't map (nfs or smb), I think that leave you with the option to map a virtual drive to the ESX host via an IPMI management interface, and then map that drive to the VM, but I can't answer if dooable via the command line. – yagmoth555 Dec 06 '18 at 20:49
  • I like the way you think, however it would probably be easier for me to get ssh/scp for a command line upload than get the console access needed for IPMI. :-) – Steve Bonds Dec 07 '18 at 18:56