How to increase the size of a VMware vmdk file formatted as linux lvm

VMware can run many cool operating systems on a single host computer. But, having run the software for an extended amount of time, i eventually always run out of space on my guest OSes. This happened a few times before, but it wasn’t until my VM really froze up on me that i figured it was time to look into extending or expanding the current virtual disk i had in use.

Have you ever tried increasing the size of a vmdk file / virtual hard disk ?
It’s not that easy.. and it’s kind of confusing.

So, once i finally figured out how to do it, i thought it would be useful to write it down so that i wouldn’t forget next time this happened. Here goes..

In my example i have:
- a Windows Vista host OS running a Fedora Core guest OS
- an 8GB vmdk file (formatted as Linux LVM – fedora fs) on the guest OS which i have backed up before attempting anything here !!!

I want to:
- increase the 8GB vmdk file to 16GB
- not lose any data saved on the vmdk file
- not move any data off/on the vmdk file

Follow these Steps:

  1. Download and Install: VMware Workstation for Windows (trial)
  2. Note the location of the VMware Workstation folder (after install) – in my case it’s “C:\Program Files\VMware\VMware Workstation”
  3. Open a Windows Command Prompt and navigate to the folder where your vmdk file resides and execute the following command:
    "C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x 16GB "Name of Your Virtual Disk File.vmdk"
    Ok, now you just made the disk twice as big but you can’t use the space yet because it’s inactive, unpartitioned, unformatted, and still utterly useless to us. (but not for long)
  4. Next, boot up the guest OS and log in as root. Verify that there is in fact a large amount of unallocated space/sectors by typing the command: fdisk -l
  5. Then we’ll partition and format the new portion of the disk. First select the disk: fdisk /dev/sda
  6. Type “n” at the fdisk menu to create a new partition
  7. Type “p” for primary partition, and then select the appropriate partition number, as well as first and last cylinders to set how large to make the new partition (defaults – ie: use all the free space – worked well for me here)
  8. Type “t” to change the partition’s system id, then type “8e” to switch it to Linux LVM
  9. Type “w” to write the table to disk and exit fdisk. You might get a warning about needing to reboot for changes to take effect – either way, reboot your guest OS just to be safe.
  10. Once rebooted, log in as root again and verify the new partition exists. Type “fdisk -l” to see a list of partitions. In my case, the new partition is: /dev/sda3
  11. Now comes the confusing part. We’re going to merge the new partition into the current Volume Group (which is just what fedora calls it’s own virtual disks that are made up of a bunch of virtual LVM partitions). So, first, to “create” the necessary “physical volume” from our newly created disk partition (/dev/sda3) first type: pvcreate /dev/sda3
  12. You need to find out the name of the Volume Group before you can extend it to include the newly created physical volume. Type: vgdisplay and look for the first line, “VG Name” – in this case it was VolGroup00 [thanks agm]
  13. Next, you need to extend the Volume Group to include the newly created physical volume. Type: vgextend VolGroup00 /dev/sda3
  14. Then, type: pvscan You should see the new partition (/1dev/sda3) in the list of partitions and the total should read approximately 16GB (the amount we set earlier). In my example, it said 15.75GB
  15. Now type: lvextend -L+8GB /dev/VolGroup00/LogVol00 to increase / extend the Logical Volume by 8GB (to a total of 16GB).
  16. Finally, to resize the filing system type: resize2fs /dev/VolGroup00/LogVol00

Now your fedora guest OS should have twice the amount of space and your VM should be running smoothly.
Repeat this process if / when the vmdk file gets filled up again and runs out of space ;)

Comments 18

  1. andrei g. wrote:

    it’s works

    Posted 09 Jan 2010 at 6:38 pm
  2. elran wrote:

    hey, you’re welcome andrei
    glad to see it’s worked for others too!

    Posted 13 Jan 2010 at 2:23 pm
  3. agm wrote:

    elran, thanks
    the only part was diff for fedora12 is VolGroup00
    vgdisplay to find display attributes of your local volume groups
    otherwise pretty straight forward steps.

    Posted 26 Feb 2010 at 2:51 pm
  4. elran wrote:

    thanks agm, that’s true!
    it looks like the default name for your volume groups in FC12 is your hostname with a prefix of “vg_” – so if your hostname for your machine is linuxbox, the name of your volume group would be vg_linuxbox (by default).

    Posted 04 Mar 2010 at 10:41 am
  5. tuan wrote:

    It works like a charm (winXP, fedora 8). Thanks a lot.

    Posted 25 Apr 2010 at 6:28 pm
  6. elran wrote:

    @tuan – glad it worked for you!

    Posted 27 Apr 2010 at 11:59 am
  7. soros wrote:

    I have searched for the solution for a whole afternoon. Thanks a lot~

    Posted 18 Dec 2010 at 4:34 am
  8. TofLaraerog wrote:

    I recently found this website that I want to share with everyopne as they were a huge help when I was
    working on a recent project. I needed to know how to do some stuff in PHP and they were able to provide
    a tutorial sepcifically tailored to my needs. It was fantastic.


    I recommend you hit them up and check them out if you need assistance.

    Posted 20 Feb 2011 at 11:23 am
  9. best life concert wrote:

    There is noticeably a bundle to comprehend about this.
    I assume you produced specific good points in functions also.

    Posted 28 Jun 2013 at 5:35 pm
  10. social media wrote:

    The game is really addictive, but if you going play it, you will expect to cash out
    money. They are not very customizable, and you
    can’t play media files on them. In fact with the correct plugins you can even turn your WordPress into a magazine-like portal.

    Posted 09 Dec 2015 at 5:47 am
  11. Sharika Kalp wrote:

    in home pet sitter in naples

    Posted 21 Dec 2016 at 7:03 pm
  12. leviafanspace wrote:

    so interesting info

    Posted 11 Aug 2017 at 10:24 am
  13. aerielfich wrote:

    click to find more info

    Posted 31 Aug 2017 at 3:00 am
  14. warcrashlap wrote:

    click my name now

    Posted 08 Sep 2017 at 9:50 am
  15. yuladzekun wrote:

    more info look here

    Posted 09 Sep 2017 at 5:22 am
  16. Stepan009 wrote:

    interesting thoughts

    Posted 02 Nov 2017 at 2:48 pm
  17. Saul Niguez Camiseta wrote:

    Rebounding as quoted before is extraordinarily fun, almost addictive. In 2009,Santiago Arias Camiseta, they won the European title and became the third team to possess the world title, the Olympic title and the continental title at the same time. Self-care and Prevention Gentle finger exercises and stretching of the affected finger can help maintain mobility of the finger. They can also develop slowly, and you need to be on the lookout for a steady deterioration. The Magento web design enables y

    Posted 31 Dec 2018 at 2:11 am
  18. Gabi Camiseta Atletico Madrid wrote:

    Customers, whether on the Web or your premises, get very impatient if system problems cause delays.American School of Doha let its students socially engage with different cultures and backgrounds, understand their responsibility towards others and the world, become a compassionate lifelong learner and step out among the peers. In 2009, they won the European title and became the third team to possess the world title, the Olympic title and the continental title at the same time. Almaeena, a member

    Posted 31 Dec 2018 at 2:13 pm

Post a Comment

Your email is never published nor shared. Required fields are marked *