Solved

VMware ESXi 4.0; When renaming a .vmdk file with vmkfstools does it automigically do the secondary .vmdk?

Posted on 2010-08-26
8
1,585 Views
Last Modified: 2013-11-11
Greetings-
     I am working on Cloning my Base VM Server so that I can build off of it again and again.  I went into the datastore via VSphere and created a new directory and copied the files to the new directory.

I then used Putty to SSH into the server.  Went to the directory of the VM in the new folder I just copied it to and did the following command.

 vmkfstools -E "BaseServer- x64.vmdk" Server-Alpha1.vmdk

I saw in VSphere under tasks that the job completed successfully.  

I went back to the Datastore browser and did a refresh and there it was Server-Alpha1.vmdk...   But there was still "BaseServer- x64-000002.vmdk"

I refreshed a bunch of times...  Logged out and logged back in...  Refreshed...  it was still there...  So, I thought to myself, self...  Just rename it like you did above and you will be all set...

 vmkfstools -E "BaseServer- x64-000002.vmdk" Server-Alpha1-000002.vmdk

Now I am left with the following....

 "BaseServer- x64-000002.vmdk"              a .5 kb file
 "BaseServer- x64-000002-flat.vmdk"        a 52,428,800 KB file

I then refreshed a bunch of times...  Logged out and logged back in...  Refreshed...  it was still there...  So, I thought to myself, self... you did so much research to get this far and you have backed yourself into a corner trying to figure it out...  Quit driving around in circles and stop and ask for directions...

So, Basically...  WTF....???  How do I clone a VM in ESXi easily...  I kinda don't want to see 50 directories of servers, Alpha1, Alpha2, Alpha3, etc...  And then have "BaseServer- x64.vmdk" replicated 50 times in the folders....  I am sure that something or someone will screw things up....

Thanks in Advance!

~~Sean
0
Comment
Question by:Daeta42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 28

Accepted Solution

by:
bgoering earned 500 total points
ID: 33537680
Use vmkfstools to copy the vmdk

To export or clone a virtual disk from VMFS
vmkfstools -i  <source-file> -d diskformat <destination-file>

Good Luck
0
 

Author Comment

by:Daeta42
ID: 33538053
Four questions...

1.  I read that you shouldn't copy the files or something like that due to something about the inability for it to recognize the new location, or something like that, but I have read to much on to many subjects today they are all melting together...  or does the vmfkstools take care of that?

2.  what does/is the "-d diskformat" option for?

3.  I am under the impression that after I do this I can go back into VSphere and the "Add" a new machine and call it, Alpha1, Alpha2, Alpha3, etc...  Matching the name that I chose for the vmdk file?  Now everything is all nice and aligned and pretty like?

4. And this will take care of the -000002.vmdk file as well...???

Thanks!

~~Sean

0
 
LVL 28

Expert Comment

by:bgoering
ID: 33538113
Lets start with number 4 first, the 000002 file is a snapshot. You should delete (commit) the snapshot before starting the copys. In the client snapshot manager select the "Delete all" option - this will merge all of the snapshot data back into the base disk then get rid of the snapshot.

1. nothing wrong with copying disk files with vmkfstools - that is one of the things it is designed for. This is the process that is used in a vCenter Server environment when cloning a virtual machine. On the other hand, if it is shared datastore, the cp command causes scsi reservations and can cause slow response on other vms that are on the disk for the duration of the cp command.

2. the -d disk format is to specify provisioning, thick or thin. Thick is the default if you don't specify a -d parameter. You can read about all the format options on pp. 239 of http://www.vmware.com/pdf/vsphere4/r41/vsp_41_esx_server_config.pdf

3. I would recommend you use the vmkfstools -i command to clone the disks into some folder (not the final destination folder) on the datastore where you will be creating your alpha vms. Then:
   a. create the vm with no disk, this process will create the folder
   b. mv the vmdk file(s) for that vm into the folder
   c. Edit settings on the vm and add hard drive, then select exisiting hard drive and add
This will get everything "all nice and aligned and pretty like."

Good Luck
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:Daeta42
ID: 33538365
Ok, I didn't know that the 000002 file was a snapshot...   I thought it was an extension of the partition (or something like that)...  I did however do exactly what you said and commit all my snapshots to the VM in question this AM and I just checked and it committed...  Nothing more to Delete under the snapshot manager...  

So, basically I can delete the 000002 file and be done with it...?  

I am going to start testing what you just said now and see how it takes me...

Thanks so far!

~~Sean
0
 
LVL 28

Expert Comment

by:bgoering
ID: 33538440
don't manually delete the file. The snapshot delete process should get rid of it. If it doesn't we need to look some more.
0
 

Author Comment

by:Daeta42
ID: 33538490
Yeah, it didn't delete it...  I am going to open another question right now for it...
0
 
LVL 28

Expert Comment

by:bgoering
ID: 33538499
do a ls -l in the folder - I would like to see the date/time stamps on the files
0
 

Author Closing Comment

by:Daeta42
ID: 33679065
sorry for the delay....  Once I got it I went to town setting up the lab...  it was most fun watching it count to 100% 227 times......weee....

0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
Teach the user how to convert virtaul disk file formats and how to rename virtual machine files on datastores. Open vSphere Web Client: Review VM disk settings: Migrate VM to new datastore with a thick provisioned (lazy zeroed) disk format: Rename a…
In this video tutorial I show you the main steps to install and configure  a VMware ESXi6.0 server. The video has my comments as text on the screen and you can pause anytime when needed. Hope this will be helpful. Verify that your hardware and BIO…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question