nsemsu
Contributor
Contributor

How to mount CD-ROM of a Deployed VM with an iso image from Command Line

Jump to solution

Hello

I have the following requirement.

1. I need to deploy a VM from scratch with an ovf and vmdk file. I figured i could do this using the ovftool. If there is any other alternative, please let me know. Is there a way to deploy just using the VMDK file and then specify the HW requirements from command line itself. ?

2. After deployment, i need to load/mount the CD-ROM of the VM with an '.iso' image. I cannot give iso file details in the ovf file. So i have to do this after deployment. This would be a bootable file which will get picked up when VM reloads. It contains network configuration for the VM. I need to do this from a linux based command line. Is there anyway to do this perhaps from the vim-cmd tool within the ESXi host.

Please help !!

TIA

Nabil

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
TheBobkin
VMware Employee
VMware Employee

Hello Nabil,

Welcome to Communities.

Unsure of the first part, more clarification might help, but for the second part you can add an iso as cd/dvd device to a VM by adding the following lines to the .vmx configuration file of the VM:

ide1:0.deviceType = "cdrom-image"

ide1:0.startConnected = "TRUE" (assuming you want to use the iso to install the VM on first boot - otherwise set to FALSE)

ide1:0.present = "TRUE"

ide1:0.filename = "/vmfs/volumes/datastorename/ISOs/filename.iso"

"I need to do this from a linux based command line."

Do you mean from an actual Linux VM/desktop of from ESXi shell? (which isn't actually Linux-based just shares some characteristics in the shell)

If the latter then the above can be inserted into .vmx faster using sed or similar (as opposed to doing it with vi).

Bob

View solution in original post

0 Kudos
4 Replies
nachogonzalez
Commander
Commander


hey. hope you are doing fine:
Why don't you try the following apporoach:
create a content library with the .iso and the .ovf file of a VM template.
For the VM template create something very generic (1vcpu / 1 GB ram) and then modify it after teh deployment is complete.

0 Kudos
TheBobkin
VMware Employee
VMware Employee

Hello Nabil,

Welcome to Communities.

Unsure of the first part, more clarification might help, but for the second part you can add an iso as cd/dvd device to a VM by adding the following lines to the .vmx configuration file of the VM:

ide1:0.deviceType = "cdrom-image"

ide1:0.startConnected = "TRUE" (assuming you want to use the iso to install the VM on first boot - otherwise set to FALSE)

ide1:0.present = "TRUE"

ide1:0.filename = "/vmfs/volumes/datastorename/ISOs/filename.iso"

"I need to do this from a linux based command line."

Do you mean from an actual Linux VM/desktop of from ESXi shell? (which isn't actually Linux-based just shares some characteristics in the shell)

If the latter then the above can be inserted into .vmx faster using sed or similar (as opposed to doing it with vi).

Bob

0 Kudos
nsemsu
Contributor
Contributor

Thanks !. This worked from the ESXi Host Shell.

I was trying to Import OVF to deploy a new VM. I am aware ovftool can be used. I came to know of VI Java APIs as well. Any idea if how to Import OVF and add ISO using VI JAVA APIs ?

0 Kudos
TheBobkin
VMware Employee
VMware Employee

Hello Nabil,

Happy to help and glad it helped you get that part sorted.

With regard to your follow-up question, that is a completely different topic and would be best asked in the relevant sub-community (that being said, this one doesn't look very active):

vSphere SDK for Java

This forum might have more insight so do have a look to see if this topic has been addressed there previously:

https://sourceforge.net/p/vijava/discussion/826592/

Other than that though, Java is not my area of expertise and thus you would probably be able to find better resources from searching online yourself more specifically for what you are trying to get done.

If you do get further insight though, please do comment back here so that others might benefit from your findings.

Bob

0 Kudos