Kategoriarkiv: Virtual Machine

Increase disk space for a VMWare virtual machine

I had a virtual machine which had about 40gig of hard drive space, and I needed to add another 20. At first I thought this would be supported by VMPlayer, but as I found out, it wasn’t. If you have VMWorkstation you will have access to a tool called vmware-vdiskmanager which is able to do just that, but since I didn’t, I had to find another solution. Thankfully, one of my colleagues had a great solution using Ubuntu.

Yes Ubuntu is an operating system. NO YOU DON’T HAVE TO INSTALL ANYTHING, not even Ubuntu! I know it seems like there are a lot of steps, but that’s just because i’ve broken them down into very small ones to make it easier. It is really not a lot of work.

NOTE!
I personally didn’t run into any issues when doing this, and my virtual machine worked fine afterwards. But since it is a delicate operation, you should really make a copy of your virtual machine before trying this.

Firstly, you have to expand the amount of disk space the virtual machine is allowed to use. This is done directly in VMPlayer when the virtual machine is shut down.

  1. Open VMPlayer
  2. Click on the virtual machine who’s hard drive you want to expand.
  3. Click on Edit virtual machine settings
  4. On the hardware tab, click on the Hard Disk in the device list. On the right hand site a Utilities drop down will appear, click it and select Expand.

NOTE:
One might think that this should be enough, and that the disk space of your virtual machine would magically expand to the set amount, but this is not the way it is. It’s not strange really if you consider a virtual machines hard drive being composed by partitions, just like a regular computer. When you expand the disk space, you simply give the virtual machine more disk space, you don’t increase the space for already existing partitions, which is not strange at all. To do this, as I said earlier, you need another tool. I’m sure there are plenty of working tools out there, and some may be easier to work with than this, but for me doing it with Ubuntu worked great.

 The second thing you need to do is increasing the space for the already existing hard drive partition within your virtual machine. You can do this by following these steps:

  1. Download Ubuntu and save the iso-file to the hard drive on your regular computer (not the virtual machine).
  2. Start your virtual machine. From the top menu bar, click Virtual Machine -> Removable Devices -> CD/DVD(IDE) -> Settings. This will open a settings dialog.
  3. On the hardware tab, click CD/DVD (IDE) in the device list.
  4. Under the Connection area, click Use ISO image file and then browse. Browse to the location of the Ubuntu ISO and open it.
  5. When the Ubuntu ISO is selected, just click OK to save and close the Settings dialog. The ISO should now be mounted and readable as a DVD from within the virtual machine.NOTE:
    Ubuntu let’s you start a demo version of the OS without installing anything. All you need to do is boot the machine using the mounted ISO. This is quite amazing if you ask me. But then again I’m not very proficient with these kinds of things.Now you need to restart your virtual machine and boot it from the mounted image. This can be a bit tricky, because you need to change the settings in the BIOS, and you hardly have any time at all to enter bios during the booting sequence.
  6. Restart the virtual machine. When it says Shutting Down, start spamming F2 (press the button repeatedly). You have like a 0,5 second window during which you have to press the button, so just pressing it worked best for me.
  7. Once you’ve entered the BIOS, go to the Boot tab and change the order of the devices so the CD-ROM Drive is positioned above the Hard Drive.
  8. Save and exit the bios (F10).The virtual machine should now boot using the mounted image, and you should come straight into the Ubuntu operating system.Note
    I had a bit of trouble while inside Ubuntu. The graphics of my mouse pointer did not appear in the same location as the actual mouse pointer, so I had a hard time clicking the right buttons. This was manageable using keyboard commands and clicking with the mouse randomly to see it’s current position.
  9. When the first screen appears, choose Try Ubuntu, don’t install it.
  10. From within Ubuntu, press the windows key on your keyboard to open a search panel. Type “gparted” and an icon for the GParted Partition Editor will appear. Press the arrow down key until you’ve selected the GParted icon and then press enter.
  11. You should now see a list of Hard drive partitions and a graphical representation of these. You can increase the size of the partition by selecting it in the list (a bit tricky if you have the mouse problem explained earlier), click the partition tab in the menubar, and then press Resize/Move.
  12.  Increase the value of the New Size to the Maximum size and press Resize/Move. A new pending operation should be created and displayed at the bottom of the screen. Click
  13. Click the Apply all operations button from the Edit tab in the menu bar.
  14. Wait until completed.
  15. To restart the computer click the windows key. Just type “terminal”, press the  arrow down key until you’ve selected the terminal icon and press enter.
  16. In the terminal window, type “sudo reboot” and press enter. Don’t forget to enter bios again when the machine restarts by pressing F2, and changing the bios settings to boot using the hard drive.

And that should be it. Worked for me at least.

Get Ubuntu here. It is a free open source operating system.

If you have VMWorkstation you should already have a tool for doing this. You can read how to here.