Solved

Shrink Allocated VMDK space- Vsphere 4- ESX 4.0 -VM's running 64 bit Linux OS - LVM Volumes- Thick Disks

Posted on 2011-03-25
11
2,107 Views
Last Modified: 2012-08-14
Hi, most of the answers I've seen to my question involve thin disks and running vmkfs-tools to zero out space and then convert to thin disks while migrating.  This won't work for me.  I need to actually shrink the allocated size of the vmdk and keep the disks as thick disks.   We have a number of Redhat Linux 64 bit VM's that were overallocated as thick disks.  They are running LVM2 on Fiber Channel Datastores (san). Our Virtual environment runs on  ESX 4.0 and Vsphere 4.0.  
Things I've tried.  
1.VMWare Convertor via vmotion datastore migration. Results Convertor doesn't give the option to change the disks size, it only sees them as 2MB disks. (Maybe because of LVM?)  
2. Platespin -Doesn't work as they are 64 BIT linux servers and PlateSpin lacks driver support.
I'm not a linux guru, so if anyone has step by step on how to reduce the size of the VMDK's by shrinking the "hard disk" in Linux, it would be helpful.
0
Comment
Question by:twtech
[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
  • 3
  • 2
  • +2
11 Comments
 
LVL 40

Expert Comment

by:coolsport00
ID: 35215039
Did you try vCenter Converter Standalone tool? Actual VMDKs are small in size because they are just 'pointers'; the flat-vmdk files are the actual 'data' files.
http://downloads.vmware.com/d/info/datacenter_downloads/vmware_vcenter_converter_standalone/4_0

Hope that helps.

~coolsport00
0
 
LVL 6

Expert Comment

by:JRoyse
ID: 35215200
There are probably better ways to do this than I am going to mention.. but I have done this for home and it works.

Try this out on a Junk VM as a test so you get the hang of it.  If you haven't use "dd" before it is really powerful.

1. Turn off the VM
2. Add a new disk to the VM the size (Thick or Thin) you want as a DESTINATION
3. boot VM off of a PartedMagic live Linux CD ISO image that you downloaded
4. use Gparted to shink all the partitions on the SOURCE disk
5. REBOOT back into Gparted
6. use the dd command to CLONE the drives dd if=/dev/SOURCE of=/dev/DESTINATION drive
7. shutdown VM
8. remove, but don't delete the SOURCE disk fom the VM
9. unconfigure booting from the partedmagic ISO
10. Start using the DESTINATION disk and boot the VM normall
0
 

Author Comment

by:twtech
ID: 35215239
Hi, we did try vmware convertor standalone tool.  It sees the disk as a 2mb disk and doesn't give the option to resize which is also what happens with vcenter convertor enterprise.  I think is this due to LVM2 in the vm OS.  Also, we tried gparted but it is not able to manipulate the partitions due to the LVM disks in the Linux OS unfortunately.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:youngstr11
ID: 35215509
Check out gparted. download the iso below then copy it to one of your vm partitions and boot to it. I would clone the machine first and test then follow the same steps. I have used it to expand a vm drive but have not tried to shrink yet. I was told that once you shrink your windows partition you can then just modify the vm disk and it will remove the unpartitioned space.

http://download.cnet.com/GParted-LiveCD/3000-2094_4-10698802.html
0
 
LVL 2

Expert Comment

by:youngstr11
ID: 35215526
Sorry when I wrote windows I misspoke this should work for both windows and Linux
0
 

Author Comment

by:twtech
ID: 35215779
Hi youngstr11, As stated in my previous reply, we have already tried gparted.  It isn't able to manipulate the Disk because of LVM2 being installed/used in Linux.  Note that I also tried using Partimage and Clonezilla with no joy.  I have to be able to shrink this using LVM2 first and then clone to a smaller vmdk somehow.  Looking for the steps to safely shrink the LVM volumes and disk and copy to a smaller vmdk if possible..
0
 
LVL 6

Expert Comment

by:JRoyse
ID: 35216377
Ok, we missed a step.

In the RedHat OS, you need to shrink the lvm volumes before Gparted can manipulate the partitions.  Use the lvm tools.

http://www.linuxquestions.org/questions/linux-enterprise-47/shrink-lvm-without-dataloss-557746/
0
 
LVL 6

Expert Comment

by:JRoyse
ID: 35216431
In the future you can also stick with separate VMFS disks for Data/OS to keep it simple.
0
 
LVL 3

Expert Comment

by:dblake15
ID: 35223108
Can't you use storage migration to change the size?  If you have it.
0
 

Accepted Solution

by:
twtech earned 0 total points
ID: 35231498
Figured this out on our own.  .  One has to use LVM to shrink the disks and move data to a smaller vmdk.  Once the data is moved and the vmdk is shrunk the disk can be detached. Here is a blog that one of our employees wrote on this process. http://ravi-vmware.blogspot.com/2011/03/shrinking-vmware-virtual-disks-with.html
Groyse was on the right track so awarding partial points.  Gparted can't be used with LVM Disks so it has to be done within the LVM Tools entirely.
0
 

Author Closing Comment

by:twtech
ID: 35304215
Jroyce's solution was accurate regarding LVM's, but we had tried that already and gparted did not work. His suggesion to use LVM was partially correct. But steps were missing for Vmware environment.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
EVC and clusters 12 59
NTPD Client Port Usage 12 65
Hardware status and alerting for ESXi servers ? 6 94
VM replication scenario and caveats ? 6 52
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

730 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