VMware Communities
mocca666
Contributor
Contributor
Jump to solution

Switched from split to single file. Now fixed size :(

Hi all,

I started my VM with a split hdd of 2GB each and then transformed it to a single file hdd.

But for some reason the file is now constantly at full size.

It's no longer growable.

In settings under Disk information it states, that the disc is NOT preallocated. But for some reason it seems like it is.

Any ideas how I can fix this?

0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

Once a vmdk has been expanded/inflated (for which reason ever) you need to shrink it manually. I've never done that myself, so you need to try this yourself. There are lots of descriptions on the internet which guide you through this. Make sure to backup the vmdk in case it does not work as expected.

http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk

André

View solution in original post

0 Kudos
18 Replies
a_p_
Leadership
Leadership
Jump to solution

How did you transform the disk?

Did you use:

vmware-vdiskmanager -r <oldfilename>.vmdk -t <type> <newfilename>.vmdk

where type should be "0" for a "Growable single .vmdk file"

André

mocca666
Contributor
Contributor
Jump to solution

hmmm...

not sure, to be honest.

so you think

vmware-vdiskmanager -r <oldfilename>.vmdk -t 0 <newfilename>.vmdk

would solve the problem?

is there a command to check the current type?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

is there a command to check the current type?

I don't know a command to do that, however there are other ways to find out the disk type.

If the disks are split into 2GB chunks, there will be a header vmdk file with the description, on other disk types the description is part of the vmdk file and starts at offset 0200h.

Another easy way is to take a look at the latest vmware.log file. Search for "DISKLIB-LINK" and you will find something like this:

Aug 15 15:23:08.139: vmx| DISKLIB-LINK : Opened 'W:\VMware\Test\Debian\Other Linux 2.6.x kernel.vmdk' (0xe): monolithicSparse , 83886080 sectors / 40960 Mb.

For the different disk types see http://sanbarrow.com/vmdk/disktypes.html

vmware-vdiskmanager -r <oldfilename>.vmdk -t 0 <newfilename>.vmdk

would solve the problem?

Depending on the current disk type it could help. Since the command actually creates a copy, you can try this without destroying anything.

André

mocca666
Contributor
Contributor
Jump to solution

Hmmm. Log indicates, that it's a growing disk.

kubuntu 10.04\kubuntu 10.04.vmdk' (0xa): monolithicSparse, 62914560 sectors / 30 GB.

But I can say with absolute certainty that the disk is 29GB as a vmdk but "inside" it's not even 10GB.

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Once a vmdk has been expanded/inflated (for which reason ever) you need to shrink it manually. I've never done that myself, so you need to try this yourself. There are lots of descriptions on the internet which guide you through this. Make sure to backup the vmdk in case it does not work as expected.

http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk

André

0 Kudos
DSTAVERT
Immortal
Immortal
Jump to solution

The safest way to shrink a disk is to use VMware Standalone Converter.

-- David -- VMware Communities Moderator
0 Kudos
mocca666
Contributor
Contributor
Jump to solution

The safest way to shrink a disk is to use VMware Standalone Converter.

I downloaded the vCenter Converter Standalone but I don't see an option to shrink a disc Smiley Sad

0 Kudos
admin
Immortal
Immortal
Jump to solution

The safest way to shrink a disk is to use VMware Standalone Converter.

Wait, what? If you're trying to reduce the guest-visible disk size, then I agree Converter is an easy way to do this ("safest" is too vague IMHO). However, if you're trying to recover host filesystem space but not change the guest, Converter is not the place to start.

0 Kudos
mocca666
Contributor
Contributor
Jump to solution

no no. i want the disk to remain at 30gb disk-size.

but i want the vmdk to be the size of the data stored on that virtual disc, i.e. if i have 10GB of data on a 30gb disc, my host should only see it as a 10gb file.

i'm currently trying the method from your link but got a segmentation fault during the writing of the zeros. currently waiting to see if it's crashed or still writing.

0 Kudos
wila
Immortal
Immortal
Jump to solution

Umm.. I hope your guest is still OK.

Actually it is very simple to shrink the disk of your guest unless your guest is linux and using ext4 as a file system.

There is however one think to be aware of.

As you have a single file disk, you need at least the same size (well a bit more as that, have a couple of GB to spare) free on disk before even attempting to shrink.

So in your case have at least 32 GB of free disk space on your host, then go into your guest OS, click on the vmware icon to open vmware tools, go to the Shrink Tab page, click the "prepare to Shrink" button. After a while you'll get a popup that asks you if you want to continue.

Yes it makes sense to have a backup of your guest, just in case, but if you have enough free disk space, it should work just fine. I've used it many many times without a problem at all.

Hope this helps,



--
Wil
_____________________________________________________
VI-Toolkit & scripts wiki at http://www.vi-toolkit.com

Contributing author at blog www.planetvm.net

Twitter: @wilva

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mocca666
Contributor
Contributor
Jump to solution

it's a linux guest so i followed the instruction in the link posted above.

apt-get clean

then create a file and fill it with zeros, delete that file, then copy the vmdk as type 0 with diskmanager

now it's 14GB. still bigger than the actual files inside the vm, but only by 3GB, so i can live with that Smiley Happy

0 Kudos
wila
Immortal
Immortal
Jump to solution

OK, well even in linux you can use the easy peasy vmware-toolbox option.

I've used the write a big file with zero's myself in the past as well, but its only needed if your guest OS or file system isn't supported. Like for example currently still with ext4 on workstation (unless this has changed now with update 7.1.1 which might be possible as I seem to recall it is already supported on ESX)



--
Wil
_____________________________________________________
VI-Toolkit & scripts wiki at http://www.vi-toolkit.com

Contributing author at blog www.planetvm.net

Twitter: @wilva

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mocca666
Contributor
Contributor
Jump to solution

given that there is no gui in linux, any idea what the commands would be?

0 Kudos
wila
Immortal
Immortal
Jump to solution

No GUI in linux? You mean you didn't install a GUI? Then I don't know if there is a CLI alternative.

If you mean, you don't see the vmware-toolbox on your desktop, then it is a matter of starting it from a console, eg. /usr/bin/vmware-toolbox IIRC, it might need elevated rights for the shrink operation though.



--
Wil
_____________________________________________________
VI-Toolkit & scripts wiki at http://www.vi-toolkit.com

Contributing author at blog www.planetvm.net

Twitter: @wilva

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mocca666
Contributor
Contributor
Jump to solution

ah. ok. found the gui Smiley Happy

however, no disks or partitions are listed in "shrink".

i am logged on as a root user and also tried "sudo /usr/bin/vmware-toolbox"

0 Kudos
wila
Immortal
Immortal
Jump to solution

Umm, you're not running Ubuntu Lucid Lynx (10.04) by any chance?

What's the output of:

sudo parted -l

The ext4 file system is not yet supported for shrink operations.



--
Wil
_____________________________________________________
VI-Toolkit & scripts wiki at http://www.vi-toolkit.com

Contributing author at blog www.planetvm.net

Twitter: @wilva

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mocca666
Contributor
Contributor
Jump to solution

Umm, you're not running Ubuntu Lucid Lynx (10.04) by any chance?

Almost :smileygrin:

I'm running kUbuntu 10.04

and unfortunately, yep, it's ext4 Smiley Sad

0 Kudos
osde_info
Enthusiast
Enthusiast
Jump to solution

see http://vizz.info/2010/09/vmware-tools-cant-shrink-edxubuntu-10-x-ext4-partitions/ for a workaround






regards

clive

http://vizz.info

regards clive http://vizz.info
0 Kudos