-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: A command to resize a vm #62
Comments
The problem with resizing is the filesystem needs to grow, which needs to happen within the instance. We're increasing the default size from the cloud-image 2.1GB default to 5GB - fortunately that doesn't mean it takes 5GB of your space, as that is allocated dynamically. We'll allow changing the default size, but I'm not sure yet we'll support resizing. Maybe we should be even more aggressive with the default, since it doesn't bear a cost to start with. |
I'll just add that we already have the '--disk' option in launch for specifying the size of the virtual disk when launching a new instance. But yeah, increasing the virtual disk size after launch will still either require a user to resize the partition inside the VM or multipass would need some magic to do it automatically, but we would need to take great care in such a case. |
We'll close this on the basis that repartitioning and growing the filesystem is beyond the scope of Multipass. We'll increase the size of the default disk, though. |
Guys, this is a HUGE issue! If resizing the disk is not an option the user should be made aware before the VM is even created, not after he has run out of space.... this is so frustrating! After spending all this time to configure the VM I run out of disk space and find out the only option is ditch the whole thing... The disk space should be made a required setting and there should be a warning that one will have to start over if he runs out of disk space. |
I'm not sure which host OS you are using, but I have found that it is possible to resize an instance's virtual disk via |
@townsend2010 thanks, I am on windows using Hyper-V and was about to try the |
Hi @okneloper, Sure, Then start the instance via Multipass and when you log in, the partition will be fully expanded. Hope this helps! |
Thanks. I've tried Using Hyper-V GUI seems to have done the trick! I'll continue using the VM and report if there are any issues. |
I'll actually reopen this, as resizing the block device seems to be enough for at least a good subset of the images we allow running. |
On OS X (High Sierra) I tried to resize image with qemu-img (5.1.0) without luck. qemu-img info seems to give the right info, but qemu-img check returns a lot of errors, and trying to fix them and then resize, gives an unusable image. I found this gist, so I tried with
and that seemed to work, |
I need this feature very badly because I run into a situation that my VM is using up the initial space after I have spent so much time setting up a dev environment in the VM and to ditch the whole thing is a big pain. |
@winkeesail you commented on two issues, both of which had explanations on how to achieve this in the comments… |
Are you saying that I should use |
these tricks make little sense to me, because qcow-tool resize does not affect the image size. |
You mean the image file size? It won't. The image files will only grow with use. |
Unfortunately, this is not the case on my machine. I use |
I'm assuming the missing $ multipass launch
Launched: suited-emu
$ multipass info suited-emu | grep Disk
Disk usage: 1.2G out of 4.7G
$ multipass stop suited-emu
Stopping suited-emu -
$ sudo /Applications/Docker.app/Contents/MacOS/qcow-tool resize --size=$(( 12 * 1024 * 1024 * 1024 )) "/var/root/Library/Application Support/multipassd/vault/instances/suited-emu/ubuntu-20.04-server-cloudimg-amd64.img"
qcow-tool: [INFO] Resized file to 22880 clusters (2928640 sectors)
qcow-tool: [INFO] image has 0 free sectors and 22876 used sectors
$ multipass start suited-emu
$ multipass info suited-emu | grep Disk
Disk usage: 1.2G out of 11.5G |
Thanks, this is helpful, I typed the wrong size. Fortunately, a smaller size has no harm to my image. |
I ran into the virtual disk size issue today. the default size is up to 5GB but my project requires more. it stopped during the compile : No space left on device (os error 28). How can I resize the VM disk or how can I set up a larger disk size during the installation? |
Right now, the question of resizing the base disk seems to have an answer of "it depends...", and involves finding the location of the disk image, knowing which tool to use, and how to use it. And I (myself) am not clear if the correct tool can even be assumed to be present at the moment, or if I have to go away and install something else. But at least once the base disk is resized, growing the partition inside it is at least a procedure that should work the same independently of the host platform. I think it would be great if multipass were able to do the most complicated/platform dependent step for me, and let me worry about growing partitions/filesystems in the guest. |
@countingpine that's exactly what this feature request is about, and we will make it happen, for sure. |
@townsend2010 I tried the I asked help and for check I got: |
Sorry, I forgot the |
I started image and used shell:
How can I check size? |
You can do You should hopefully see under the |
Also, if this did indeed work, you can delete that copy of the image you made in order to save disk space on your Mac. |
IT WORKED, tks for your patience, |
Hooray!!!! 🎉 |
I had the same problem as @jstanley0 and thanks to @lucasnetau's comment, I was able to create a new image from the old image and booted the instance successfully again:
|
Not worked, also path is wrong in the script: |
This is perfect , worked for me. Thanks @nana-marinbio @townsend2010 |
I had to amend this slightly, to qemu-img-hyperkit resize was not a valid command, but qemu-img resize did it. (Of course everything after |
I tried both this method and the Resize-VHD method, but I'm not getting any additional space. I tried this command:
But still getting: |
This is not a solution to resizing the disk, but a workaround that I found worked for me to solve the problem of running out of disk space: just extract the folders containing too much data into your physical computer and mount them into the VM. For example let's say you have a folder taking too much space in your VM's home under Do this from inside the VM: cd /home/ubuntu
mv .gradle .gradle.old Then do this from your physical computer: # Replace "multipass_vm_storage" with whatever folder you decided to store your VM files in
cd ~/multipass_vm_storage
mkdir .gradle
# Replace "primary" with whatever name your VM has
# You can list VMs with the `multipass list` command
multipass mount .gradle primary:/home/ubuntu/.gradle Then do this from your VM: cd /home/ubuntu
# Moving all files from the VM-hosted folder to the mounted physical-computer-hosted folder
mv .gradle.old/* .gradle/
# Optionally delete the old empty gradle folder
rm -rf .gradle I hope this helps! |
I think this was added in recent release of multipass. I'm able to do:
Much cleaner. |
https://multipass.run/docs/modify-an-instance#heading--set-the-cpu-ram-or-disk-of-an-instance - documentation for the feature mentioned by @sbs2001 |
@townsend2010 I fond the Then I saw you guys have added this as a feature and there is nice documentation which @weisdd linked. Honestly, this is one of the nicest cross-platform VM management tools I've seen! Really smooth on Mac, and I love that I can go to other OS and have a uniform(ish) experience. |
thanks, worked for me on Windows 💯 |
|
After expanding the disk, you need to expand the partition and extend the filesystem from within the vm, eg with https://manpages.ubuntu.com/manpages/xenial/en/man1/growpart.1.html |
If your vm disk is at 100% the changes won't take effect. Try to free some space first and rerun the commands.
|
In where do i write that on windows 10/11? |
@kangarooo On either Powershell or Command Prompt (CMD). |
I have an existing VM that's run out of space, it would be really nice if I could resize it. Or even better would be a VM with a dynamic size on disk.
The text was updated successfully, but these errors were encountered: