While browsing the VMTN community forums today, I noticed a very interesting post about mounting the CD-ROM device from within ESXi. The solution involved the use of vsish as the traditional mount utility did not function as expected in the Busybox Console of ESXi. I thought this was a very clever solution and might be worth sharing for those that may have similar needs.

Note: This trick looks like it only works with ESXi 4.1, as previous releases of ESXi may not include the iso9660 VMkernel module.

First you will need to load a VMkernel module: iso9660 which will allow you to mount and access the CD-ROM device.

You will need to run the following command:

vmkload_mod iso9660

You should see a successful message after the module has loaded:

Note: To see a list of VMkernel modules that can be loaded/unloaded, take a look at /usr/lib/vmware/vmkmod

Next you will need to identify the path to your CD-ROM device, you can do so by using the esxcfg-mpath utility.

You can run the following shorthand command to locate the path:

esxcfg-mpath -b | grep "CD-ROM"

You should see something in the form of mpx.*:

Now we will use vsish to perform the mount operation. Before we get started, if you did not perform the VMkernel module load of iso9660, you would not see the following path in /vmkModules/iso9660. Once the module has been loaded, you can perform a "ls" (listing) of the operations supported by this module which is mount and umount. You will need to run a "set" operation on the "mount" command and specify the device in which you would like to mount.

You will need to run the following command:

vsish -e set /vmkModules/iso9660/mount $(esxcfg-mpath -b | grep "CD-ROM" | awk '{print $1}')

If you do not see any messages after executing the command, it was successful, else you may see an error/warning for incorrect syntax.

The CD-ROM device will automatically be mounted under /vmfs/volumes/mpx.* and there will also be a symlink with the CD-ROM label. In this example, I mounted an ESXi 4.1 Update 1 ISO file.

We can change into the directory to confirm we actually have the CD-ROM device mounted and list the contents.

Once you are done with your task, to umount is the same syntax except you will be using the "umount" operation. You can unmount by using the following command:

vsish -e set /vmkModules/iso9660/umount $(esxcfg-mpath -b | grep "CD-ROM" | awk '{print $1}')

Another alternative is to mount the image on another system and copy the contents to your ESXi host, but if you only had your ESXi host and needed to pull something from a CD-ROM, this is how you would do it.

Thanks again to agodwin for sharing this tidbit.

10 thoughts on “How to mount a cdrom using vsish on ESXi

  1. pity that it doesnt work on vSphrere (ESXi) 5.0

    ~ # vsish -e set /vmkModules/iso9660/mount $(esxcfg-mpath -b | grep “CD-ROM” | awk ‘{print $1}’)
    VSISHCmdSet():Set failed: Not supported

  2. I did it once, i use the instructions and mount & umonut the CD successfully, but when i try to make it again a have VSISHCmdSet():Set failed: Not supported

    any Idea?

  3. On vSphere (ESXi) 5.0.0 Build 469512 do the following:

    1. load the iso9660 module (vmkload_mod iso9660)
    2. run esxcfg-mpath -b |grep “CD-ROM” (note the mpx.* string of the drive you want to mount)
    3. run /sbin/vsish (it will bring you to the VMkernel Sys Info Shell kernel prompt)
    4. Type the following, replacing the mpx.* string with the one from step 2 (I had to run the following command twice, the first time failed. I assume its because of the way the Dell iDRAC mounted my local CD-ROM drive): set /vmkModules/iso9660/mount mpx.vmhba38:C0:TO:L0
    5. Type exit (to exit the VMkernel Sys Info Shell kernel prompt)
    6. The CD-ROM or DVD-ROM will be mounted in /vmfs/volumes.

  4. I am trying to import files from a mounted CD-Rom during a kickstart install: I cant seem to get it to work?

    # +—————————————————————————+
    # | Import the SED form the DVD-ROM, unzip the .tar file and register the VM
    # +—————————————————————————+
    vmkload_mod iso9660
    vsish -e set /vmkModules/iso9660/mount $(esxcfg-mpath -b | grep “CD-ROM” | awk ‘{print $1}’)
    post_dir=/vmfs/volumes/$(hostname -s)-datastore1/Staging_Folder
    mkdir -p ${post_dir}
    cp -r ${source_dir}/* ${post_dir}
    sleep 5
    tar -xvf /vmfs/volumes/$(hostname -s)-datastore1/2012.tar -C /vmfs/volumes/$(hostname -s)-datastore1
    sleep 5

    # +—————————————————————————+
    # | Register the SED with ESXi
    # +—————————————————————————+
    vim-cmd solo/registervm /vmfs/volumes/$(hostname -s)-datastore1//

    Any Idea’s

    [email protected]

Thanks for the comment!