I need help expanding the disk space on my Ubuntu VM
Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need help expanding the disk space on my Ubuntu VM
I initially assigned 4GB to my Ubuntu VM in VMware but that seemed to fill up instantly now i can't do anything without getting an error message saying that i need to expand the disk. But when i go to the VM hard disk settings and expand it, nothing changes. A tutorial said i need to use a "Gparted" ISO but i don't know how to run disk's in Ubuntu. When i click on it, it just opens up a bunch of files. Sorry, i am clearly a newbie and i need to get this sorted ASAP.
Location: North of Boston, Mass (North Shore/Cape Ann)
Distribution: CentOS 7.0 (and kvm/qemu)
Posts: 91
Rep:
Expanding Disk in VM
Remember, there are two parts to expanding disk in a VM.
First, the VM manager (or hypervisor or whatever it's called in your world -- for me on CentOS I talk to QEMU using virsh).
Here you assign more disk to VM in question.
Second, the VM has to be made aware there is more disk space, and then do whatever it has to do to incorporate it into one (or several) of the disk systems within.
Step ONE is a piece of cake -- and sounds like you've already discovered how to do that.
Step TWO depends on lots of things.
If the VM is Windows, there is a power-shell code you must run to adjust the disk.
If the VM is Linux, there is some shell scripting that needs to be done. Since I have LVM both in my main machine and within my CentOS VM, it's handled nicely and almost transparently.
If your main machine is OS/X, the parallels hypervisor gives you a slider bar and it does both sides quickly and painlessly.
I don't know if VMWare (that's what you're using, righ?) gives you the tools to do both from the one setting, like OS/X's Parallels, or a two-step process like QEMU & CentOS (my case).
A little google'ing will get you the procedure you need to run on the VM side.
Almost hard to believe you ever had Ubuntu installed on 4Gb virtual hard drive. Guess cli could be on maybe 1.5G
Just delete the thing if this is simply a test. Delete the vm machine and remove files. Start over with at least a 32Gb virtual hard drive. Most VM's will create a very small file to start. It won't be 32Gb unless you really do fill it up next time.
Location: North of Boston, Mass (North Shore/Cape Ann)
Distribution: CentOS 7.0 (and kvm/qemu)
Posts: 91
Rep:
increase disk space
Hi:
Agree with the others to just build one anew.
However, don't delete the old.
I had to create a new Win and a new Linux (my old one had a major blow up during a YUM update that was huge).
For linux, I used
Code:
scp
to copy anything I needed from the old to the new.
And some stuff I had to re-install but forgot a setting or two, I could bounce back and forth.
When I thought that I was done, I just left the old one to NOT start automatically -- why throw it away until you have to. In the game of GO, even dead stones have usefulness.
BUT, I'd try some of the suggestions about how to grow it, just for the learning experience.
(Depending on your time availability, you could do this AFTER you made something anew.
I guess if you really did want to save the exact data then I'd do this.
Make a new virtual hard drive much larger and attach to the original machine.
Boot to a clonezilla iso.
Clone the smaller drive to the larger drive.
Power down vm and remove original small drive and make the second one in it's place.
Remove the clonezilla iso
Reboot. May have to run filecheck once in a while. Fstab in some cases may be off or grub off.
A tutorial said i need to use a "Gparted" ISO but i don't know how to run disk's in Ubuntu.
First, you're not running Gparted in Ubuntu, you're running it in VMware. So download an ISO of Gparted. Shut down your vm. Attach the gparted ISO to your VM. Fire up the VM.
This will grow it, whereas NNNNN (or NNNNNN) is the size in MB you want to grow it, e.g. 80000 = 80GB. Once its grown, launch the guest and use its GParted to grow the partition, if it won't launch, boot the guest as others mentioned with a bootable GParted iso, and grow it into the empty space.
That is a new one on me. Might have been there forever too.
"The --resize x option (where x is the desired new total space in megabytes) allows you to change the capacity of an existing image; this adjusts the logical size of a virtual disk without affecting the physical size much.[39] This currently works only for VDI and VHD formats, and only for the dynamically allocated variants, and can only be used to expand (not shrink) the capacity. For example, if you originally created a 10G disk which is now full, you can use the --resize 15360 command to change the capacity to 15G (15,360MB) without having to create a new image and copy all data from within a virtual machine. Note however that this only changes the drive capacity; you will typically next need to use a partition management tool inside the guest to adjust the main partition to fill the drive."
"need to use a partition management tool inside the guest to adjust the main partition to fill the drive"
So may have more hoops to go through depending on disk state as in format, partitioning, boot, and advanced features like lvm or other raid.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.