VMware {code} Community
OxygenOne
Contributor
Contributor

Injecting Files into a Virtual Disk?

Hey there everyone. I am wondering if there is a way to inject files into a virtual disk (vmdk) using the SDK or command-line tools. Here is the situation:

I want to write something (using the SDK) that can clone a VM, and then edit some files on the virtual disk of that clone before the first boot so that it is ready to go (and the user does not need to edit anything). The reason I want to do this programmatically is because there could be a ton of these hosts being deployed, and not having any need for the user to do anything would be ideal. The problem is that these need to be non-Windows[/i] hosts (Linux, FreeBSD). From the ESX Configuration forums, it seems that mounting the virtual disk is a non-trivial task that would be difficult to achieve using a script (since the offsets vary from disk to disk). So I am wondering how to achieve this, because from what I understand, it was possible to do this in older versions of ESX (there was a command line tool to mount VMDKs), but not in 3.0.

Thanks in advance for any help or suggestions

\-- OxygenOne

0 Kudos
3 Replies
hrobinson
VMware Employee
VMware Employee

Without making any promises, this functionality is planned for future releases.

In the interim, I know you can always attach a .vmdk to VM and do it there.

H

0 Kudos
OxygenOne
Contributor
Contributor

Thanks for the response. I guess I will have to figure out some way to get it working, because this functionality is absolutely critical.

0 Kudos
danielh
Contributor
Contributor

Hello,

for microsoft os you can use microsoft sysprep to autologon after cloning to start some scripts in the new virtual machine. Have a look at Sysprep GuiRunOnce. Maybe you can solve with this functionality your issue.

http://pubs.vmware.com/vi30/sdk/ReferenceGuide/vim.vm.customization.GuiRunOnce.html

As I see there aren't such a functionality offered for linux os. Smiley Sad

kind regards

daniel

0 Kudos