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,576 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
  • 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
 

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
Teach the user how to use configure the vCenter Server storage filters Open vSphere Web Client:  Navigate to vCenter Server Advanced Settings: Add the four vCenter Server storage filters: Review the advanced settings: Modify the values of the four v…
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now