I have a VM that I increased on the of the disk drives by 100GB temporarily, so that we could do an upgrade. I no longer need that volume at that size and I was wondering if I could decrease that volume by the 100GB and maybe even apply it on a different VM? These are both Windows 2008 servers.
Unfortunately it's not possible to decrease the disk size easily. In order to do this you need to use the free Converter and do a volume based conversion, which allows you to define the target virtual disk size.
André
... and maybe even apply it on a different VM?
Sorry, missed that. Are you talking about using the virtual disk with the current size for another VM? Yes that's possible, but you should move the virtual disk to the new VM's location/folder to avoid confusion in the future.
André
Sorry, should have been more clear. I'd like to decrease the one volume by 100GB, as it's no longer needed and they use that 100GB of disk space to increase a volume on another VM.
In this case you'll need to go with the Converter to reduce the disk size.
André
Is the converter easy to use? I won't lose any data on the disk that I'm shrinking, will I?
Yes, the Converter is very easy to use. Just ensure you select volume based (rather than disk based) conversion in the advanced settings for the target, to be able to change the disk size. You don't need to worry about issues, because the converter will create a copy of the VM without touching the source if you run it with the source VM powered off. This way you can always go back to the original VM in case the clone doesn't work as expected.
André
Thanks. Do you know where I can download the converter? Does that need to be run on the VM I'm shrinking the volume of, the vSphere server, does it matter?
You can find the download link at https://my.vmware.com/web/vmware/downloads
You may install the Converter on a PC or Server. You can then select the host on which the VM is located in the Converter's GUI. I'd suggest you run the conversion with the source VM powered off if you can afford the downtime.
André
Could someone please explain this in more detail or supply the information on how this is done? I have downloaded and installed the convertor and it is absolutely useless. Can't connect to any server running or not. Am I suppose to connect to the vCenter Server nodes to populate the list of virutual servers I have? Am I suppose to connect directly to the server I wish to change? What, where, why, how????????
This has to be easier that all of this. Where is the process??????
Really ? not possible to decrease size?
I find that a bit "one sided"
Although you can increase the size in vSphere, Edit settings, i fail to see why you can't decrease, since its a toggle up/down...
Seems VMare just didn't allow this, because the moment you loose focus, it goes back to how it was before... Thus, you probably must decrease via VConverter instead...
Did VMware do this on purpose, or is there a technical reason why it can't be decreased from vSphere GUI ?, since the option is there,, they just need to enable it to decrease in the GUI.
I'm guessing in VConverter you would choose 'remote machine' and enter the credentials of your ESXi server, then on the 'Summey' page, you can choose to decrease/or increase at will
Well, think of it. Decreasing the disk size would also require to decrease the guest operating system's partition(s) on the disk, and - depending on where the data is located within the partitions - relocating the data. In order to do this, the Hypervisor would need to know the specifications all possible file systems.
André
Create a new vmdk disk with required size and attache it to the vm > boot using Acronis Disk Director > Move all the Volumes from the OLD Disk to the newly created one > Restart and booom machine is up with the new Disk.
I used the converter also. It's too bad there isn't an easier method but, there is a whole lot more than just reducing disk size packed into this tool, so it's a pretty good method.
Create a new virtual disk (of the desired size), install a program like Partition Wizard (http://www.partitionwizard.com/) and copy the big disk into the small one.
To move (or copy) to another VM simply copy the vmdk file into the other VM directory and add it.
how can reduce the linux vm ?
SOLUTION:
I look you search more complicated solutions, the life is more simple
Yes is possible and very easy to do. Without any vmware tool. Only looking the not virtual life. I named it THE REAL MODE.
If you have a disk of 150 Gb, but only have 50 Gb of information.
Steps:
1) Create a disk in vmware of 50 Gb and attach to the windows 2008 machine
2) Defrag in windows the 150 Gb machine
3) Boot from cd with a live cd iso like system GParted -- Live CD/USB/PXE/HD
4) Use Gparted to shrink the partition to 50 Gb from the 150 Gb disk you want shrink --> Now you have a 50 Gb partiton
5) Use Gparted to create partition msdos table to the new 50 Gb disk
6) Use Gparted to copy from 150 Gb the new 50 Gb partition to the 50 Gb disk
Now you have a 50 Gb with the original partition copied from the 150 Gb disk
7) remove the 150 Gb disk and configure the 50 Gb disk to set for example SCASI 0:0 or the primary sata or ide
Now you have your machine in a 50 Gb virtual disk
THE PROBLEM 8) And it's problem from windows 2008, now from this 50Gb the windows 2008 not boot, i don't have time to investigate, secure by boot config, but with a Windows 2008 Installation DVD ISO I start from it, and I made repair windows startup. With this solutioon windows 2008 boots correctly:
Boot from Windows 2008 ISO:
a) No install, select --> Repair Windows
b) Advanced Options
c) Startup Repair
😎 After it Boot correctly, only automatic disk check for possible problems, but boot correctly.
I do this solution 2 times with the same good result.
Good luck!
Jorge Duran
Sorry for my English!
The same with Linux!
Cause I like been a rebel here is the way to do it with just ESXi/vSphere and Linux tools. The below instructions is with a CentOS machine. As always test this with a test machine before you try it on a real system. Always make a backup before you do this. I'm not responsible for your data loss. This was tested on vSphere/ESXi 6.5.
Shrinking a physical volume in VMWare (LVM2)
1. Boot your system with a LiveCD
2. Open terminal window
3. Run a FSCK on the volume you are going to shrink
sudo e2fsck -pfv /dev/mapper/VolGroup-lv_root
4. Use LVREDUCE to reduce the logical volume size to something a little lower than what is intended. In my case I want to make it 40GB, but since I can always extend I will choose 38GB to give myself some room.
sudo lvreduce -L 38G -resizefs -v /dev/mapper/VolGroup-lv_root
5. Now lets resize the physical volume to 39GB (sda2 is the physical volume with the LVM partition)
sudo pvresize --setphysicalvolumesize 39G -v /dev/sda2
6. Shutdown your VM.
7. While in ESXi or vSphere remove the VM from inventory
8. Log into the ESXi server via SSH
9. Go to the desired location of the VM
cd /vmfs/volumes/VM_DATASTORE_1/testvm/
10. vi the vmdk file, NOT the file with FLAT on it
vi testvm.vmdk
11. Use the following formula with the new size you want to use. In this case I will use 40GB for X
Formula [X * (1024 * 1024 * 1024)] / 512 = X = Resulting Size in GB
12. On the RW line you will see a big number, remove this number and use the following formula to get the right size for 40GB:
for 40GB the number is 83886080
So the line should look like so:
RW 83886080 VMFS "testvm-flat.vmdk"
Save and exit to the command line
13. Now shrink the vmdk to a new file
vmkfstools -i testvm.vmdk -d thin shrunk-testvm.vmdk
14. Now backup the original to a new file
vmkfstools -E testvm.vmdk orig-testvm.vmdk
15. Now replace the base file with the shrunk version
vmkfstools -E shrunk-testvm.vmdk testvm.vmdk
16. Reregister your VM in ESXi or vSphere again
17. Boot your system via your regular OS.
18. Resize the physical volume
sudo pvresize /dev/sda2
18. Use lvextend with resize2fs to extend the logical volume to the physica dimensions of the disk.
sudo lvextend -resizefs -extents +100%FREE /dev/mapper/VolGroup-lv_root
Hope this helps someone.
Thank you jamdev120
This worked like a charm. Saved me a few hours of work.