How to expand the ext4 primary partition size in a VMware Player virtual disk?

45,705

I was just doing exactly that a minute ago. What you want to do is:

  1. In the machine's settings point the CD Drive to the .iso file with your Ubuntu LiveCD. You may also need to make sure the "Connect at power on" check box is checked.
  2. Power the virtual machine on and hit F2 with the focus inside the machine.
  3. Once inside the BIOS move to the Boot tab and select CD-Rom as primary boot device.
  4. Run gParted - I think it's always there.
  5. Destroy the swap partition: swapoff, delete the extended and linux-swap partitions.
  6. Resize your primary partition to desired size.
  7. Allocate your swap back again to whatever you like - create an extended partition and then allocate as linux swap. Remember about swapon :)

And that's it. You now have a big primary partition!

In my case you'd need to have Jedi reflexes to get into BIOS by pressing F2 on the splash screen - the boot delay is just too short. What you can do to slow it down is go to your vm's .vmx file and type in something reasonable like:

bios.bootDelay = "5000"

For 5 seconds of boot delay.

Share:
45,705

Related videos on Youtube

ysap
Author by

ysap

I've been a computers/computing enthusiast since many years ago. Started coding FORTRAN on punched cards, then moved to BASIC on my MC6809 based DRAGON-64 and then the x86 IBM-PC era. I had the opportunity of working on mainframes, minis, workstations, PC's and embedded hardware. Today I am doing mainly embedded coding - C and ASM on various processors, and on various programming environments and toolchains like MS Visual Studio, Eclipse CDT, ARM DS and more. Was lucky enough to be at the right time at the right place to get to work as a VLSI designer for a top tier chip company, working on a world class processor family. Always looking to solving problem in the most elegant way! - Yaniv Sapir

Updated on September 18, 2022

Comments

  • ysap
    ysap over 1 year

    I have a VMware Player virtual machine setup, running Ubuntu 10.04 as the a guest OS.

    The VM was created on a 20GB virtual drive, with a single partition for working space. Finally I got to the point where I need to expand the size of the virtual drive. Resizing the drive itself, adding some 10GB, was easy via the VMware Player menus. I now need to resize the main partition itself (I prefer this over creating a separate partition and mounting it).

    According to GParted, I now have the following partitions:

    enter image description here

    My question is, how can I increase the size of the Filesystem partition to include the free 10GB?

    From information I found online, it looks like one limitation is the fact that he swap partition is immediately adjacent to the filesystem, so my understanding is that first thing would be to move that partition to the end of the volume. How can this be done?

    Also, some sources suggest that the system should be booted from a LiveCD, so the filesystem is not the boot partition, and thus make it easier to resize. As mentioned above, I run a VM, so I am not sure how to boot it from a LiveCD. Any ideas?

    • psusi
      psusi almost 11 years
      You tell vmware to boot from the cd image, just like you did the when you first installed Ubuntu in it.
    • ysap
      ysap almost 11 years
      @psusi - thanks. The VM is run with VMware Player, not VMware, so i am not sure where to tell it to boot from CD. Also, obviously, I need to boot the VM on which I currently work form the CD. The only time I remember pointing to the ISO was when creating the VM, and there everything was done automatically.
  • ysap
    ysap almost 11 years
    Thanks, by this time, I already added a partition past that swap partition. I then mount that filesystem in my primary filesystem, and continue as usual. However, your answer will probably be valuable next time I need to increase the drive size :-)
  • Brent Faust
    Brent Faust over 10 years
    Very nice. At least in Fusion 6, the quotes are not allowed. Use: bios.bootDelay = 5000
  • Roman Badiornyi
    Roman Badiornyi over 10 years
    Really big thank you for bios delay option. You saved a lot of my time :)
  • OscarRyz
    OscarRyz almost 10 years
    This worked perfectly. You can also use bios.forceSetupOnce="TRUE" as an alternative to bios.BootDelay kb.vmware.com/selfservice/microsites/…
  • Chuck Claunch
    Chuck Claunch about 9 years
    This worked great for me, but I'd like to add that I had to go to the virtual machine Settings > CD/DVD and check the box that says "Connect at power on". Using VMWare Player 7.0.0.