This stupid board won't let me update the original doc so I'll post this here (assuming this will let me)...
I think it's a MAJOR pain not having a "clone" feature in VMWare Server without using Virtual Infrastructure, so I made my own Linux shell scripts to do it.
The clone script does a straight clone of a VM. It copies the directory, renames the files and tweaks all the text inside the files by using sed to replace the old name with the new one, then sets all the permissions to what they would be if you created a new VM.
The rename script basically does all but copy it. This is handy for if you tried to rename a directory manually or attempted a manual copy and then found it still shows up under the old name in the web console. Remember this one assumes you have already renamed the directory to the new name and it MUST be the same as what you intend for the new name to be.
Both work the same way... ./scriptname <old name> <new name>
You can use quotes around the names if there are spaces, I went to great lengths to make sure it would still work with spaces in names (although I personally hate spaces).
Save the scripts to the base directory where your VM's are, "standard" location is "/var/lib/vmware/Virtual Machines". Make executable with chmod +x <scriptname>.
Once ran, add the new/renamed VM to the web console and choose "I copied it" or "I moved it" as appropriate.
These scripts are offered free to everyone to use, modify, or do anything else you want with except take credit for the original version, and you accept that there is absolutely no warranty or guarantee of any kind on the part of anyone that they will work and won't hose your VMs or even your whole system. (I'm reasonably sure they work and won't break stuff though )
This is the first major revision. The same script should now work for single-file and split disks because rather than relying on file and extension names I am using the UNIX file command to determine if the files are text files and parsing those for editing. This also means they will work in ESX (and probably any other VMWare virtualization product) without modifying. The files are being edited in place with sed -i instead of being edited into a temp file and then renamed back to the original names. Due to that, the permissions settings in the copy script are unnecessary and have been commented out. They remain in the rename script though, because it is assumed that the rename script would be used after someone just tried copying the folder to a new name and found out that doesn't quite work as expected - in this case I think it's appropriate to make sure everything is as it should be. Last, there is an option to create backups of the text files that get edited - to use this, edit it to set BACKUP to "YES". IMO this option will mostly be useful for testing and troubleshooting purposes, and usually not desired.
I think it's a MAJOR pain not having a "clone" feature in VMWare Server without using Virtual Infrastructure, so I made my own Linux shell scripts to do it.
The clone script does a straight clone of a VM. It copies the directory, renames the files and tweaks all the text inside the files by using sed to replace the old name with the new one, then sets all the permissions to what they would be if you created a new VM.
The rename script basically does all but copy it. This is handy for if you tried to rename a directory manually or attempted a manual copy and then found it still shows up under the old name in the web console. Remember this one assumes you have already renamed the directory to the new name and it MUST be the same as what you intend for the new name to be.
Both work the same way... ./scriptname <old name> <new name>
You can use quotes around the names if there are spaces, I went to great lengths to make sure it would still work with spaces in names (although I personally hate spaces).
Save the scripts to the base directory where your VM's are, "standard" location is "/var/lib/vmware/Virtual Machines". Make executable with chmod +x <scriptname>.
Once ran, add the new/renamed VM to the web console and choose "I copied it" or "I moved it" as appropriate.
These scripts are offered free to everyone to use, modify, or do anything else you want with except take credit for the original version, and you accept that there is absolutely no warranty or guarantee of any kind on the part of anyone that they will work and won't hose your VMs or even your whole system. (I'm reasonably sure they work and won't break stuff though )
This is the first major revision. The same script should now work for single-file and split disks because rather than relying on file and extension names I am using the UNIX file command to determine if the files are text files and parsing those for editing. This also means they will work in ESX (and probably any other VMWare virtualization product) without modifying. The files are being edited in place with sed -i instead of being edited into a temp file and then renamed back to the original names. Due to that, the permissions settings in the copy script are unnecessary and have been commented out. They remain in the rename script though, because it is assumed that the rename script would be used after someone just tried copying the folder to a new name and found out that doesn't quite work as expected - in this case I think it's appropriate to make sure everything is as it should be. Last, there is an option to create backups of the text files that get edited - to use this, edit it to set BACKUP to "YES". IMO this option will mostly be useful for testing and troubleshooting purposes, and usually not desired.
Attachments:
- rename_vm.sh (1.1 K)
- clone_vm.sh (1.2 K)