Do you have your output from the script still? It's possible that I didn't account for every possible variation in naming... It checks to make sure the VM is shut down, but is it possible it was running? Also, I don't know if it works on VM's with snapshots, so I would for now recommend deleting any snapshots before attempting a clone.
Things I would check are to make sure all the filenames look right, then:
grep "oldname" .v
grep "newname" .v
You should not get any results from "oldname" except maybe in the binary .vmdk file, which the script leaves alone.
You can also dump the hard disk from the VM settings and re-add it and see if that fixes it.
I also use 2.0 final + Ubuntu 8.04 and haven't seen this problem. One possibility is the renaming of the vmdk could be upsetting it, although that seems unlikely since I've done i lots of times this way now without issue. I can try changing it to rename the .vmdk files using vmware-vdiskmanager -n instead of just renaming with a mv command and see if that does it, I'll have to play with it a little to get that working.
I don't have the output, sorry. I was bored since I first tried it and put ESXi on that host to do some testing. I do recall looking for references to the old name and I didn't find any. I will do more testing with this when I can get Server 2.0 on Ubuntu installed on another host.
-Josh.
NOTE ON ABOVE: There is supposed to be an asterisk after the .v in the grep lines... the board was kind enough to interpret that as formatting instead ![]()
I also neglected to mention that you SHOUD get lots of results grepping "newname" since that should have replaced "oldname" in all the files.
Thanks for these scripts! clone_vm.sh worked great on my Ubuntu Server with VMware Server 2.0. Check out my post about creating a W2K3 template for future clones using your script at http://vmetc.com/2008/10/25/linux-scripts-to-clone-and-rename-vmware-server-vms/#more-1176
Hi.
Great scripts!!
One question though.
I have a win2k guest i want to clone on my vmware server 2.0 on Ubuntu 8.04 server.
After i ran the script i get this error: "Hard disk not valid" after the vm-copy was added in the "VMware Infrastructure Web Access".
What can be the problem???
Best regards,
Nicolai
On the cloned PC:
If you created the hard drives to be split into 2Gb files, the main .vmdk file has to be edited so that the
#Extent description refers to the 2Gb .vmdk files.
The script does not seem to rename it.
Can someone post a description of what this looks like so I can modify the script to include it?
Thanks, Rob
Nice work phxRider.
When your script ends, you have to go to Vim to 'register' the new VM. I made some modifications to your script for shutting down VM and registering in the server after copied using vmrun. Those are the commands I've used:
1.vmrun -T server -h http://10.10.10.1:8222/sdk -u user -p password suspend "[standard] vm/vm.vmx"
2.your script
3.vmrun -T server -h http://10.10.10.1:8222/sdk -u user -p password register "[standard] vm/vm1.vmx"
Now I'd like not to go to the Console web access to answer the question 'Do you copied or Do you move?'. Do you know how to automate this step? Any ideas about grant permission on vm to users (command way)?
Regards
David
Hi,
I've got an error on cloned virtual disk using the clone-split-disk.sh. I find that there is a vmware tool to rename vdisk (vmware-vdiskmanager)
and i ask you why you do not use it to rename vdisk. Can you help me to modify the script?
Good day,
Thanks to phxrider for this good work.
I have made some improvements of his scripts. You could find clone_vm2.sh and rename_vm.sh on my profile. (I hope the publication of my scripts will work.)
greeting,
--
CSS
Thanks for this! I too think it's silly that there's no clone feature in Server. When I run this it completes without errors but after I add the clone to inventory it shows 'hard disk not valid'. Any ideas? I'm running Ubuntu 8.04 with the latest rev. of Server 2.0.
-Josh.