VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 2 Previous Next 15 Replies Last post: Aug 27, 2009 2:15 PM by NetOpsA1  

Clone Virtual Machine with VMware Server 2.0 posted: Sep 28, 2008 1:39 AM

Click to view VMBladeMan's profile Lurker 3 posts since
Aug 22, 2008

Good morning, i am a user Italian and i apologise for my English.

I'm usinv VMware Server for test at home, i'm created of VM and i would like to clone without having to recreate.

In the release 1 of VMware i'm clone the folder with the existing VM and add the new VM that points to the new folder.

You can do the same thing with the release 2 ?

Thank you for their help, you can take.

Nino


Italian translation

Buongiorno, ho effettuato l'aggiornamento alla release 2 di VMware Server che utilizzo a casa per effettuare dei test e per studiare.

Vorrei clonare delle VM come facevo con la release 1.

Nella release 1 duplicavo la cartella e poi importavo una VM esistente puntando alla cartella duplicata. Nella release 2 non riesco a farlo perchè al nome della cartella viene aggiunto il suffisso _001, _002 etc.

Potete darmi qualche indicazione su come poter fare?

Grazie

Nino


Re: Clone Virtual Machine with VMware Server 2.0

1. Sep 28, 2008 2:24 AM in response to: VMBladeMan
Click to view Paul Thomas's profile Master 861 posts since
Dec 30, 2007

Hi,

The process is exactly the same, I have cloned many VMs with server 2.

Close the VM down

Copy all files to a new directory (ensure the new directory is within a datastore, or create a new datastore.

Start the new VM, answering that it has been copied when prompted.

Start the original VM.


Re: Clone Virtual Machine with VMware Server 2.0

3. Sep 29, 2008 1:34 AM in response to: VMBladeMan
Click to view mgyhardsoft's profile Novice 9 posts since
May 9, 2007
Hi,

Solution a) is interesting, did it work anytime?
I always use what you've written solution b) and it works. Why do you want to rename any file at all? The directory name and the file names together mean the virtual machine and because the directory names are different so will be the virtual machines. You can rename the virtual machine itself and it is just enough to make distinctions among them.

Rgrds: M. Gy.

Re: Clone Virtual Machine with VMware Server 2.0

4. Sep 29, 2008 5:03 AM in response to: VMBladeMan
Click to view luvit's profile Enthusiast 44 posts since
Sep 25, 2008

i rename the cloned folder and create a new name in the VM console for the cloned VM.

whenever i try to rename files i mess things up... so i dont rename files anymore.


VMware Server 2.0
Host: Vista
Guest: XP sp1

Re: Clone Virtual Machine with VMware Server 2.0

6. Sep 29, 2008 1:48 PM in response to: VMBladeMan
Click to view mgyhardsoft's profile Novice 9 posts since
May 9, 2007
Unfortunately not, I never wanted and I never tried to rename the configuration file. I've just found no reason to do that. There's no need to work with the file directly after adding the virtual machine to the inventory - so doesn't matter how it is named.

Re: Clone Virtual Machine with VMware Server 2.0

7. Dec 12, 2008 8:36 AM in response to: mgyhardsoft
Click to view mcdonamw's profile Novice 7 posts since
Sep 22, 2006

I'd like to reopen this as I have the same question but would like to add something.

In VMware Server 1.0, when you created new VMs, the resulting VM name was the name of whatever you wanted (including the directory name, but the configuration files took on the name of the operating system you installed (i.e. Microsoft Windows 2003 Standard.vmx). This I could live with when I was doing the "manually copy files into new directory for VM cloning".

In VMware Server 2.0 however, when I create the VM, everything takes on the VMname itself, including the configuration files. Now my VM is named ServerX as well as the config file being named ServerX.vmx, etc. Now if I clone these files over to a new VM name in a folder called AnotherServerZ, the config files are still named as the original. How can I clone these and rename the files?

I've tried simply renaming the config files and opening them up and replacing any reference to the old name to the new, but that seemed to have just fubared the entire VM and it will no longer load. I had to copy the disk.vmdk file into a complete newly generated VM in order to load the VM up again.

Is my only option to create a new VM without a hard disk using the new name I want, copy the previous VMDK disk file into the newly created dir, and associate that VMDK file to the new VM?? Why is there no clone option??

-Matthew

Re: Clone Virtual Machine with VMware Server 2.0

8. Dec 29, 2008 12:10 PM in response to: VMBladeMan
Click to view BMcDonald's profile Lurker 1 posts since
Dec 29, 2008

Found out a way to do it. Glad to finally be able to contribute after having taken so much away from these forums. Good luck.

1. Create target VM directory

2. Copy all files from source VM directory to target VM directory

3. Rename all file prefixes in target directory to your new VM name

4. In the VM console do a "Create Virtual Machine"
- Give it the same name as your target directory created above
- Select the relevant options through the following screens (O/S, memory, etc)
- When on the Hard Disk screen, select "Use an Existing Virtual Disk"
- Browse to and select the New_VM_Name.vmdk in your target directory
- Set the remaining options (network adapter, floppy, usb) and finish the wizard.

5. Go to the VM Console, highlight your new VM and do a "Remove Virtual Machine" (DO NOT select the option to delete files)

6. In your datastore folder in your filesystem you will see a newly created directory with three files only. If your target VM directory from step 1 was created here, you will have another directory of the same name but with a "_1" appended (e.g. New_VM_Name_1". Copy the three files from this directory into your target directory from step 1 and overwrite the existing ones.

7. In the VM Console do an "Add Virtual Machine to Inventory". Select the target directory from step 1 and choose the New_Server_Name.vmx.

8. Start the VM from the console

9. At this point it's O/S specific and my example is for CentOS 4.7. You will need to reconfigure the VM for a new adapter with a new MAC (else you will get an error booting), as well as the network settings(IP, DNS, etc). Follow the steps below to do so.

- Upon booting you should be promted by the application Kudzu about hardware changes. Hit any key within the alloted time to enter Kudzu.

- You will get a "Hardware Removed" screen regarding the old adapter settings. Select "Remove Configuration".

- The next screen is "Hardware Added". Select "Configure" and configure the new IP address, DNS, etc.

10. The server should now boot. After logging in, change your hostname in the DNS Settings of the Network app, or manualy edit /etc/sysconfig/network. Reboot.

11. Voila!

Re: Clone Virtual Machine with VMware Server 2.0

9. May 8, 2009 2:47 PM in response to: BMcDonald
Click to view Derrick32's profile Lurker 2 posts since
May 8, 2009

Hello all,

I followed Bmcdonalds post up until i got to Step 4 "When on the Hard Disk screen, select "Use an Existing Virtual Disk" ". i have a virtual machine named V100, i went into my virtual machines folder and made a new file called v200, copied everything out of the V100 folder in to V200 folder, named all files to V200.xxx ( basically anything saying V100 i renamed and changed the 1 to a 2 to make v100's v200's). Then went to create a new machine from vmware console, filled the new name out as V200 and rest of settings up until use existing virtual disk step. First of all i can see my v100 and my v200 folders ( from the console in v100 theres only 2 .vmdk folders, but in the V200 folder there is a bunch) I select any folder in v200 and then i get an error "the virtual disk you selected is not a valid virtual disk"

Was i not supposed to copy ALL files out of the V100 folder??

Was i supposed to change something inside any of the files other than the prefix??

Any help would be appreciated..

Thanks,

Derrick

Re: Clone Virtual Machine with VMware Server 2.0

10. Jul 19, 2009 9:33 AM in response to: Derrick32
Click to view remur's profile Novice 6 posts since
May 27, 2006
HOWTO by example :)

1)
make a copy of a disk image (it can take a whiiiiiile) :
vmware-vdiskmanager -r old_winxp.vmdk -t 2 temp_winxp.vmdk
2)
in web manager create new machine,
name it "new_winxp",
when asked about a disk chose "use existing disk" and point it to the copy you made before,
you'll get directory new_winxp/ with 3 files inside - new_winxp.vmsd, new_winxp.vmx, new_winxp.vmxf
3)
move file(s) of your new disk image to new_winxp/
4)
rename your disk image:
vmware-vdiskmanager -n temp_winxp.vmdk new_winxp.vmdk
5)
edit new_winxp.vmx file and change paths to point to new location of your disk image
6)
power up the clone :)

Result - full clone of original virtual machine with all filenames reflecting name of clone and not the original machine

Re: Clone Virtual Machine with VMware Server 2.0

11. Jul 15, 2009 12:14 AM in response to: Derrick32
Click to view guyrleech's profile Virtuoso vExpert 1,858 posts since
Mar 6, 2006
Depending on the type of disk (.vmdk) that you have, the disk file referenced in the .vmx file will actually be a small ASCII file that contains the details of the actual binary files. This is certainly the case when the disk is split into 2GB chunks. If this is the case then you need to edit this .vmdk text file to change the file names in here too.

Guy Leech
VMware vExpert 2009

---
If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points.

Re: Clone Virtual Machine with VMware Server 2.0

12. Jul 15, 2009 12:54 PM in response to: guyrleech
Click to view remur's profile Novice 6 posts since
May 27, 2006
as I described in a first step use vmware-vdiskmanager,

if you use vmware-vdiskmanager with option -r it will convert the disk, but it will not overwrite the original, it will create a converted copy of it (maybe there is an option to overwrite original files, but we don't really want to find it ;) ),

if you choose the same type of disc (option *-t*) as the original you will actually create a clone of the original disk (just disk, not a machine)

vmware-vdiskmanager creates correct entries in .vmdk file in process of converting disk,

as .vmdk (disk description file) and all files containing parts of a disk are in the same directory you don't have to change paths in it as the paths simply don't exist there and the filenames will be correct wherever you will put the whole bunch of files

after creating new virtual machine and moving your disk to destination directory, where all files of that virtual machine are stored, all you have to do is to edit .vmx file deleting the path and leaving only name of .vmdk file

Re: Clone Virtual Machine with VMware Server 2.0

13. Jul 15, 2009 12:53 PM in response to: remur
Click to view Derrick32's profile Lurker 2 posts since
May 8, 2009

Thanks remur. Will be trying this out.. Anyplace i can find a list of command line options for VMserver??

Also, someone else here pointed out a problem with my naming convention. Even when i do clone V100 to V200,opening up V200's files in notepad i still see V100 referenced throughout these files. It was suggested to me when i make my original machine whether it is Win XP, OpenBSD or any flavor of Linux, name it accordingly on first install THEN change the name with VMserver. That way those files that do get copied over read the OS rather than my original vm's name.. any input on this??

Thanks again for everyones help!!

Re: Clone Virtual Machine with VMware Server 2.0

14. Jul 15, 2009 1:14 PM in response to: Derrick32
Click to view remur's profile Novice 6 posts since
May 27, 2006
what host OS are you using ?
you mean for vmserver itself or for vmware tools like vmware-vdiskmanager?

if you follow the recipe I described above you won't have any problems with names
the reason why I tried to find a way to do this is that I like to have each machine in separate directory and all files named regarding to machines name,
all I could find online was complicated and required lots of editing - it wasn't acceptable when somethimes I had to clone around 10-20 machines a day
I spent an hour or two to find the way and I am using it to clone machines ever since and never had any problems

VMware Beta Programs

Want to be Considered for Future Beta Programs?

Learn More

VMware Developer

Download SDKs, APIs, videos,
training, and more in the Developer community.

Learn More

Developer
Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld
Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

Only VMware ... Delivers Nexus 1000V

Ensure consistent, policy-based network capabilities to virtual machines across your data center.

Learn More

Communities