简体   繁体   中英

Just expanded disk size - VM now unusable - How to expand in VM?

I just expanded a Ubunutu 14.04 disk using the vmware gui from 20GB to 30GB as I was running out of space. As a parting shot it warned me that I had to expand the partition in the host machine.

Now the host machine does not have gparted installed and the disk is somehow flagged as having no space left, so I cannot install any gui disk manager.

I am not very versed in using fdisk and I am now stuck with a dead VM. It boots and looks normal, but I cannot seem to find a way to fix the disk partition or expand it and flag it as usable.

I would appreciate any help as this is my development VM and I am running out of ideas. I will post back promptly in response to any questions.

EDIT: I managed to get gparted to run, but it refuses to allow me to expand the partition and there are TWO blocks marked unassigned after the main disk, I moved the swap to the end of the cylinders. It's like the two unassigned blocks are faulty in some respect.

Solution! I went into fdisk (sudo fdisk /dev/sda) and deleted the rogue partition (which was marked unassigned). After this I was able to go back into gparted and extend the partition.

So, for reference, the whole procedure was as follows:

  1. With the VM shut down, in Workstation select edit the machine configuration, go to disks and extend the size of your drive. This will now leave your system with a space AFTER the swap, which you don't want.

  2. In gparted turn the swap off. Then make a new swap at the end of the disk, delete the old swap, mark the new swap as swapon.

  3. Enter fdisk and delete the rogue partition which gparted can't seem to work with ( sudo fdisk /dev/sda, p, d, 2, w ). This will delete the old swap which is marked unassigned but bugged for some reason).

  4. Back into gparted and extend your partition. Check that the swap is set to swapon, reboot.

That worked for me. It is hardly ideal and not for the feint of heart. You certainly will want to back up before you do anything to your disks.

This was on Ubuntu 14.07. I hope it comes in useful for someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM