VMware Cloud Community
lbogus
Contributor
Contributor

Need to shrink a linux vmdk

I have a linux system that has a 75gb vmdk but is only using 15gb. I would like to resize the drive to 20gb but not sure if it is possible. I tried to look at converter but it will not resize a linux partition, only Windows. I'm not very familiar with linux so not sure where to look.

0 Kudos
9 Replies
azn2kew
Champion
Champion

You can use VMware P2V Converter and during the process just specify smaller size in GB and it should work fine. If the Linux is a virtual machine, you can still use P2V Converter and treat it as P2V but its actually V2V and still works fine too similiar process.

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!!

Regards,

Stefan Nguyen

VMware vExpert 2009

iGeek Systems Inc.

VMware, Citrix, Microsoft Consultant

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Regards, Stefan Nguyen VMware vExpert 2009 iGeek Systems Inc. VMware vExpert, VCP 3 & 4, VSP, VTSP, CCA, CCEA, CCNA, MCSA, EMCSE, EMCISA
0 Kudos
lbogus
Contributor
Contributor

I am running vSphere and have already tried to use converter. When I get to the disk it shows as unknown and you cannot change the size. After doing some research it looks like that is the case with converter, it will not change the size of a Linux volume. You can only change the disk size of a windows volume. I thought on the previous versions you could resize a Linux partition, but since I have upgraded I no longer have the older version to look at to see if I am correct.

0 Kudos
continuum
Immortal
Immortal

Add a second disk to the VM with size as desired.

Then boot into knoppix or whatever your prefered Linux LiveCD is and clone large disk to small disk.

When done - temporarily remove the large disk and check if the small disk works. If yes - delete the large disk

___________________________________

VMX-parameters- VMware-liveCD - VM-Sickbay


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

0 Kudos
lbogus
Contributor
Contributor

Since I'm not very familiar with Linux I am fumbling a bit here. I have tried to add a second disk and one of the things I did was to do a dd if=/dev/sda2 of=/dev/sdb1, but since my target drive was smaller than the original drive I received an error. What would I need to do to make a clone of the drive to a small disk?

0 Kudos
azn2kew
Champion
Champion

Do you have any 3rd party imaging software like TrueImage that can shrink it too. Or you can use VMware Tools to do the wiping process and instructions below

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!!

Regards,

Stefan Nguyen

VMware vExpert 2009

iGeek Systems Inc.

VMware, Citrix, Microsoft Consultant

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Regards, Stefan Nguyen VMware vExpert 2009 iGeek Systems Inc. VMware vExpert, VCP 3 & 4, VSP, VTSP, CCA, CCEA, CCNA, MCSA, EMCSE, EMCISA
0 Kudos
rriva
Expert
Expert

As other people said :

  1. Shutdown your VM

  2. Add a second disk of the desidered size (i.e.30 GB)

  3. boot with Knoppix

  4. Locate the first disk and write down the device (i.e. /dev/sda)

  5. Locate the second disk (i.e. /dev/sdb)

  6. clone the first disk to the second one with the following command
    dd if=/dev/sda of=/dev/sdb

  7. shutdown the vm

  8. detach (NOT DELETE) the first disk

  9. power on the VM and check if all works

If all works fine .... check again .....

If all works fine again ... sleep 1 week Smiley Happy and than delete the first disk from your datastore.

You should also use third party cloning software as Norton Ghost or True Image ..... but it will be a little more expensive Smiley Wink

Bye

Riccardo Riva

VCP,RHCE,FCNSA

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful". Thank You!

RRiva | http://about.me/riccardoriva | http://www.riccardoriva.com
0 Kudos
lbogus
Contributor
Contributor

I did try exactly what was stated but when I did the dd option I received an error message because the drive I was copying too was smaller than the original.

And yes, we are cheap and trying to find the easiest and "free" way around this! ?:|

0 Kudos
azn2kew
Champion
Champion

Can you use trial version of ghost image or TrueImage tool that would tempoary workaround.

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!!

Regards,

Stefan Nguyen

VMware vExpert 2009

iGeek Systems Inc.

VMware, Citrix, Microsoft Consultant

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Regards, Stefan Nguyen VMware vExpert 2009 iGeek Systems Inc. VMware vExpert, VCP 3 & 4, VSP, VTSP, CCA, CCEA, CCNA, MCSA, EMCSE, EMCISA
0 Kudos
lbogus
Contributor
Contributor

I will see what I can do with the trial version.

0 Kudos