Easy way to transfer files to a VM from the outside

I find myself frequently needing to copy files such as application installation files from my workstation to the guest OS running inside a VM. Sure you could do this using UNC paths and shares by connecting to the VM at the guest OS layer and authenticating with the VM and then copying files with Windows Explorer but this can be a pain sometimes. It also means that those files are taking up space on the VM and if its only temporary and you’re using thin provisioning you can’t easily reclaim that space. I also find myself installing the same applications on many VMs and to have to copy the files to each VM can be time consuming.

So instead of messing with copying files through the guest OS layer using a copy utility, I prefer to copy them through the virtualization layer using an ISO file. By using an ISO file I can easily mount it on the VMs CD/DVD drive and then access the files without having to copy them to the VM’s file system. This is the same method by which VMware Tools is installed on a VM, the VMware Tools install binaries are mounted from a special mount point on the host disk partition to the CD/DVD drive of a VM so they can be installed. You’ll notice if you create a VM without a CD/DVD drive that you won’t be able to install VMware Tools and will receive an error if you try.

2011-11-24_161603

So you might think, creating an ISO file, isn’t that a pain in the butt as well. It’s actually very quick and easy and once you create it you can use it over and over on any VM to install applications with and copy files to VMs if needed. You can keep a collection of them on your workstation and mount them from your local disk or you can copy them to a host datastore and mount them from there. I sometimes create toolkit ISO images that contain many of the typical applications (i.e. Sysinternals, disk tools, etc.) that I use when troubleshooting problems within a VM. Windows still does not have the native ability to read or write ISO files but there are a number of free tools that you can create ISO files with such as ImgBurn, CDBurnerXP (works on Win7) and ISO Recorder. I usually use ImgBurn but ISO Recorder is even easier as you can select the files/folders that you want to include in the ISO file and launch it via the Windows Explorer menus like below.

2011-11-24_164311

Next you simply select a directory and a name to save your ISO file in, click Next and your ISO file will be created.

2011-11-24_164619

You can now mount it inside the VM using the virtual CD/DVD drive of the VM by browsing to the ISO file you just created so you can access all the files inside the ISO file from within the VM.

2011-11-24_164952

That’s it, quick and easy, takes less than a minute to complete and much easier then having to copy files through the guest OS of the VM.

Share This:

5 comments

Skip to comment form

    • Sergio Munoz on November 24, 2011 at 11:54 pm

    Great post, I just identified lot of ISOs to build.

    Thanks,
    Sergio

    • Michael Russell on November 25, 2011 at 3:28 am

    Hi,

    Just wanted to say nice tip! I never think of using the CDROM after install but this is a handy way to inject bginfo and other regular scripts into a VM! I’m sure some security guy will lock me down at some point but until then….!!

    Mike

    • Carlos Garcia-Moran on November 28, 2011 at 11:18 am

    Great Tip, ive used this myself quite a few times in the past when copying files to DMZ VM Guests. Ive always used “folder to ISO” tool since it’s portable but never thought to use the other tools you listed

    thx!

    • Frans van Dokkumburg on November 29, 2011 at 10:53 am

    Nice post, the tool foldertoiso is also a great tool and doesn’t need any installation

    • Marabiloso on January 9, 2012 at 5:47 pm

    If your files are to be used with a Windows VM, the simplest may be to make a CIFS share, that’s a right click away from sharing the same repository to many VMs on multiple hosts, I don’t see the point of duplicating the data in an ISO, and the hassle of “burning” a virtual CD/DVD/BluRay?

    The same would apply for Linux with NFS, with the huge advantage that NFS is recognized by the ESX and allows vMotion and svMotion, so your files may be shared at the same time between multiple VMs and ESXs. And you may mount your ISOs loopback over NFS, which is nice for installation.

    So, what are you using ISOs for, already?

Comments have been disabled.