?
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
Medium Priority
?
1,590 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 2000 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If we need to check who deleted a Virtual Machine from our vCenter. Looking this task in logs can be painful and spend lot of time, so the best way to check this is in the vCenter DB. Just connect to vCenter DB(default DB should be VCDB and using…
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.
Suggested Courses

752 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