Let us pretend that you have an Ubuntu Server which has been running for several years and it has been doing itâs assigned task(s) nicely, until one day you make a change to your methodology/assumptions/workflow/tasks therefore the allocated Virtual Drive (VHD) size is no longer sufficient. There are many reasons for this, but I ran into this issue twice in one weekended because I enabled a JDS as a Distribution Point (thus MySQL was eating needing a lot of space) and wanting to test multiple NetBoot NBI sources (because 10.10.2 seems to be causing imaging troubles). I need to increase the size of two different VHDs, however if you setup your Ubuntu Server via âEasy Install Modeâ enlarging the VHD is not that strait forward.
Doing a quick search to see what VMware has to say about this issue returns less than helpful information for Ubuntu Servers by stating man fdisk
. Google searching throws a lot of ideas, therefore Iâm providing what Iâve learned from a couple of hours of research.
Increase size? I donât think that word means what you think it means
First letâs get a baseline of a default âEasy Installâ of Ubuntu Server. We can see that we have a 20GB VHD by several ways:
- Looking at our VMware Fusion Setup
- Running
sudo fdisk -l
- Running
df -H
Here is my test VM as it stands right now. You can see the VHD settings are for 20GB (really 21.5, guessing there is a rounding error somewhere), and that our primary partition is /dev/sda1 with 19GB drive.
Now it would be really nice if VMware Fusionâs tools to increase the VHD worked as expected. If we could just simply move our slider (or type in a new value) for our desired HD space that would actually increase our storage space, that would be perfect!
We start our Ubuntu Server to verify that our new drive is now 30GB of storage, however what we see is the Virtual Environment believes we have 30GB (32.2 specifically) but our /dev/sda1 partition is still at 19GBs?!
What we have done is expanded the allowable space to be used, but we didnât actually adjust the partition size. We need to do that with some more awesome open source tools.
Steps to Increase your VMware Fusion partition
First we are going to use a Linux Live CD called GParted. Download their 234MB ISO to your VMware Fusion host so you can attached the ISO to the CD/DVD drive. Once attached, use the Startup Disk options in VMware Fusion to select the CD/DVD drive.
Assuming you are a native English speaking individual and that you have a âUSâ keyboard setup, you can safely hit the Enter key for a couple of times to get to the GParted application. GParted will show you some critical information that we must overcome:
- Our original partition of 20GB is at the beginning
- Our swap space is in the middle
- Our extra space is at the end
Unfortunately with this GUI application you cannot just âdragâ or âmoveâ the extra space next to our original drive to expand your partition. Instead, we have to methodically move things around so everything lines up in the proper order. To do this weâll perform the following steps in order:
- Enlarge the âextendedâ space to take over our unallocated area
- Move our swap space from the beginning to the end of our âextendedâ space
- Truncate the âextendedâ space to only focus on the swap space
- Enlarge our primary partition to use the new unallocated area
To verify everything is running again, change your startup disk back to your Drive in VMware Fusion, restart your VM and run the same commands from the beginning.
Sources
Comments are closed. If you have a question concerning the content of this page, please feel free to contact me.
Comments
Justin
One should always try to use Google with âderflounderâ in the search stringâŚ
https://www.google.com/#q=vmware+expand+virtual+drive+derflounder
Mo
life saver! thank you!
Me
Great
Me
worked like a charm!
Vipul
Very much helpful. Works exactly as mentioned in the article.
Me
Much appreciated!
Namrita
Worked for me. Thanks a lot!!
ali
Very helpful. Worked as described! Thanks a lot. :)
Scott
Thanks!
Ethan
THANK YOU!
Richard Sadowsky
Very helpful article. Appreciate the level of detail and screen shots. Worked great.
kumar gaurav
After wasting few hours i came across this article which helped me resolve the exact same issue listed here. Awesome article. Thanks a lot !!
Ken
Many thanks, very helpful!
Edward
First article that I found that was clear and methodical enough to be useable for me. Thanks a lot for taking the time to work this out!