VMware Communities
HamzaUmar
Contributor
Contributor
Jump to solution

How to convert pre-allocated disk to growable? [SOLVED!]

Hi all,

Don't worry my question is not so tough. I have installed VMware Workstation 10 and have installed Win XP SP3 as a guest OS on Win8 x64 host. I made a pre-allocated disk on c: drive and now space is running low (space on C: drive) and I want to convert it to growable.

I sure have checked this : Examples Using the VMware Virtual Disk Manager but I cannot figure out how to use these commands. Whenever I open VMware Virtual Disk Manager it closes immediately. So how can I use this second command ? Can anyone tell me ?. Thanks in advance. Smiley Happy

Message was edited by: HamzaUmar

Message was edited by: HamzaUmar

1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

It's actually the replacement/renaming which wasn't correct.

Depending on the virtual disk format, a virtual disk can consist of:

  • a single <vmname>.vmdk file which contains metadata as well as user data
  • two files where <vmname>.vmdk contains the metadata and <vmname>-flat.vmdk contains the user data
  • multiple .vmdk files where <vmname>.vmdk contains the metadata, and the other .vmdk file (...f00x.vmdk or ...s00x.vmdk) contain used data

Note: There are also a few other file types, but these are the main ones.

With the conversion you ran (-t 0), you created a "single growable virtual disk" which contains metadata as well as user data.

To ensure I don't give you wrong directions, please let me know which .vmdk files you currently have?

From the steps you provided, I assume you still have the renamed new.vmdk on the F: drive which you used to overwrite the Windows XP Professional-flat.vmdk. If this is the case - and with the low disk space you have on the C: drive - I'd recommend you use the "growable virtual disk split in 2GB files" (-t 1) for the virtual disk. This will allow you to increase and/or compact the virtual disk in the future without the need of a huge amount of additional disk space.

So again, assuming the virtual disk file on the F: drive is the one which you still have, you could delete the current "Windows XP Professional.vmdk" and "Windows XP Professional-flat.vmdk" files in the VM's folder on the C: drive (please consider to backup the files before deleting them), then rename  "Windows XP Professional.vmdk" on the F: drive back to "new.vmdk" and run:

vmware-vdiskmanager -r F:\new.vmdk -t 1 "C:\Virtual Machines\Windows XP Professional\Windows XP Professional.vmdk"

This will create the "Windows XP Professional.vmdk" descriptor file as well as a number of "Windows XP Professional-s00x.vmdk" files depending on the provisioned virtual disk file. With the 15GB virtual disk you should end up with ...-s001.vmdk through ...-s008.vmdk.

André

View solution in original post

0 Kudos
16 Replies
RDPetruska
Leadership
Leadership
Jump to solution

The vmware-vdiskmanager is a command line utility - you have to run it from a command prompt.  run it with no parameters and it will display help, and example syntax.

0 Kudos
HamzaUmar
Contributor
Contributor
Jump to solution

Well thanks for replying. But my problem is still not solved. Smiley Sad

I opened cmd and ran vmware-vdiskmanager from there. It ran fine (the info about syntaxes popped up). But when I wrote command (see 1.png) it said "Disk name or some other argument is missing" and then the whole bunch of syntaxes again  (see 2.png). :smileyconfused:   Then I re-wrote the command including the full path of file name (see 3.png) but still I get the same error as in 2.png Smiley Sad .

A little help here please. :smileyplain:

1.png

1.PNG

2.png

(look at the third line from the start)

2.PNG

3.png

3.PNG

upon executing this it returned the same result as in image 2.

A little help here please. :smileyplain:

0 Kudos
continuum
Immortal
Immortal
Jump to solution

the syntax is
vmware-vdiskmanager -r "Windows XP Professional.vmdk"  -t 0 new.vmdk

Never specify the flat.vmdk - always use the vmdk that is referenced in the vmx-file.
And note: the command creates a copy - so make sure you have enough free disk space

when the conversion is done - remove the existinmg vmdk from the config and add the newly created one


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

RDPetruska
Leadership
Leadership
Jump to solution

Since the file name and path contains spaces, you must surround it with double-quotes.  And, you can't use the same disk name as both source and destination.

HamzaUmar
Contributor
Contributor
Jump to solution

Thank you very much continuum for replying. Some more things to ask:

1 - Can I re-use again the name Windows XP Professional.vmdk instead of new.vmdk ?

2 - My existing vmdk is 15 GB so will it require 15 GB extra on that drive for the copy? (Doesn't make sense since the new type is growable and shall occupy less space than existing)

3 - In the last line you mentioned "config". Is this in the VMware Workstation settings? or I have to manually edit any file (vmx for instance?) ?

I'll appreciate if make me more clearer. Thanks in advance bro.

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

1.) If you want to keep the existing name, just specify another directory for the target .vmdk and move/replace the files when done.

2.) The required disk space depends on the used data blocks (i.e. blocks which are not zeroed out) on the source .vmdk. Maybe it makes sense to run sdelete in the guest OS to zero out unused blocks prior to converting the virtual disk.

3.) The VM's configuration needs to be changed/adjusted if the virtual disk's name is different.

André

0 Kudos
HamzaUmar
Contributor
Contributor
Jump to solution

What the hell... :smileyangry:

I used the same syntax as told by continuum above, with specifying other drive for new.vmdk because disk space was running low on C:\ (host OS) .

It said something like invalid configuration file of Windows XP Professional or maybe something like can't read configuration file (I don't remember correctly, I just know that I hadn't touched anything and my VM was working perfectly without any errors or warnings) and in the below line it said converting :  x%, with x increasing gradually.

When conversion reached 100% it said "Conversion successfully completed". And then on the other drive new.vmdk was there but... AGAIN 15 GB???. According to Andre, the new one should have a size of 9 GB (the space occupied by the guest OS in Virtual machine). Well never mind, I replaced it with the original one, thinking maybe the disk type had changed, but... Workstation said "The file specified is not a virtual disk" . :smileyshocked: Smiley Sad. I think now I have to re-create the disk and re-install Windows XP Pro. Smiley Sad Any suggestions that maybe there on how I can fix this without re-installing?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

What exactly did you do? How did you replace the files (you cannot just rename them!)? Which commands did you use? What did you change in the configuration and how does it look like now? Please provide a complete list of files (the output of dir *.* /one), compress/zip the VM's .vmx and log files and attach the .zip file to a reply post.

Regarding size reduction, did you zero out the guest OS before running the conversion?

Since it looks like you didn't backup the VM's folder prior to modifying the VM, I'd strongly recommend you do it now to ensure things won't become worse!

André

0 Kudos
HamzaUmar
Contributor
Contributor
Jump to solution

Thanks Andre for keeping in touch with me.

here is the image of the directory that looked prior to running the command :

1.png

and here is where the vdisk manager is present :

2.png

So this is exactly what i did :

1 - I used Sdelete to zero out free space on C:\ drive inside the virtual machine. (This C:\ drive that I mentioned in this line is of guest OS NOT of host).

2 - Then I closed the VM and ran vdisk manager in host OS using cmd with admin privileges.

3 - I typed the command :  "vmware-vdiskmanager -r "C:\Virtual Machines\Windows XP Professional\Windows XP Professional.vmdk" -t 0           F:\new.vmdk" (because the space on C:\ drive of host OS was running low thats why I chose F:\ drive for new.vmdk)

4 - After executing this command it stated something about the configuration file (I didn't snapped the image of process because I thought it was going okay). In the     below line it said "Converting " and showed the progress in the percentage ahead of it. The progress was gradually increasing so I thought the               process is going fine.

5 - After the conversion completed successfully I renamed new.vmdk to Windows XP Professional-flat.vmdk in F:\ drive (I thought the previous one had       also "-flat" in its name so the new one must also has it). Then I replaced the newly created .vmdk with old Windows XP Professional-flat.vmdk in C:\       drive of host OS.

6 - I ran the VMware Workstation to check if disk type had changed but NO... It said "The file specified is not a virtual disk" (see below)

3.png

A few more notes :

a) I have only done creating and replacing

b) I did not changed the vmx configuration file manually (by manually i mean opening vmx with notepad and editing things), so please tell me if I have to do so.

c) If have taken any wrong step please tell me that too.

d) Now my directory looks same as image 1 (That last .vmdk file is the new one)

THATS ALL WHAT  I DID!

I'm looking forward for your reply.

I'm attaching all files except last .vmdk in image 1 in a zip file.

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

It's actually the replacement/renaming which wasn't correct.

Depending on the virtual disk format, a virtual disk can consist of:

  • a single <vmname>.vmdk file which contains metadata as well as user data
  • two files where <vmname>.vmdk contains the metadata and <vmname>-flat.vmdk contains the user data
  • multiple .vmdk files where <vmname>.vmdk contains the metadata, and the other .vmdk file (...f00x.vmdk or ...s00x.vmdk) contain used data

Note: There are also a few other file types, but these are the main ones.

With the conversion you ran (-t 0), you created a "single growable virtual disk" which contains metadata as well as user data.

To ensure I don't give you wrong directions, please let me know which .vmdk files you currently have?

From the steps you provided, I assume you still have the renamed new.vmdk on the F: drive which you used to overwrite the Windows XP Professional-flat.vmdk. If this is the case - and with the low disk space you have on the C: drive - I'd recommend you use the "growable virtual disk split in 2GB files" (-t 1) for the virtual disk. This will allow you to increase and/or compact the virtual disk in the future without the need of a huge amount of additional disk space.

So again, assuming the virtual disk file on the F: drive is the one which you still have, you could delete the current "Windows XP Professional.vmdk" and "Windows XP Professional-flat.vmdk" files in the VM's folder on the C: drive (please consider to backup the files before deleting them), then rename  "Windows XP Professional.vmdk" on the F: drive back to "new.vmdk" and run:

vmware-vdiskmanager -r F:\new.vmdk -t 1 "C:\Virtual Machines\Windows XP Professional\Windows XP Professional.vmdk"

This will create the "Windows XP Professional.vmdk" descriptor file as well as a number of "Windows XP Professional-s00x.vmdk" files depending on the provisioned virtual disk file. With the 15GB virtual disk you should end up with ...-s001.vmdk through ...-s008.vmdk.

André

0 Kudos
HamzaUmar
Contributor
Contributor
Jump to solution

Thanks again Andre for you very helpful post. My VM has successfully ran with growable & splitted disk type all because of your help.Smiley Happy Bless you pal!

0 Kudos
Stamoulisk
Contributor
Contributor
Jump to solution

Thanks for this solution-article. I just follow te instructions and the previous 50GB preallocated space i used for my VM , just turned into 10GB of actually used space. Because i am involving with VM's not a long time ago, i found a problem at the end of the conversion. I found out that only the *.vmdk files are converting. All the other files (*.logs , *.vmsd , *.vmx , *.nvram etc.) are not transfered to the new directory. SO i just copy and paste them from the old directory with the pre-allocated disk space, to the new growable disk space. And magic, i saw the VM opening and running with the new space. Many thanks to all of you.

0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

RDPetruska wrote: And, you can't use the same disk name as both source and destination.

Actually, as I sure you well know, the sourceDisk.vmdk and the destinationDisk.vmdk can indeed be the exact same name providing the path of the destinationDisk.vmdk file is in a different location then the sourceDisk.vmdk.  It can then be moved into the VM's folder afterwards after moving the sourceDisk.vmdk out.

0 Kudos
louyo
Virtuoso
Virtuoso
Jump to solution

Well, he said that about a year ago and Andre pointed out the use of a different path... Smiley Wink

Lou

0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

louyo wrote: Well, he said that about a year ago and Andre pointed out the use of a different path... Smiley Wink

The thread was bummed today by Stamoulisk and when I scrolled down to read the reply and then saw the reply from RDPetruska having been marked as helpful and being somewhat erroneous I chose to comment on it having not read the entire thread regardless of what else may have already been said.  I did so because IMO if something is marked as correct or helpful and it contains erroneous information it should either be edited or pointed out, nothing personal and the timeframe is somewhat irrelevant considering it was less then a year!

louyo
Virtuoso
Virtuoso
Jump to solution

I knew you had a good reason, I just wanted to see it.

Lou

0 Kudos