Skip to content
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

Change disk image size #2636

Closed
Valexr opened this issue Jun 25, 2021 · 28 comments
Closed

Change disk image size #2636

Valexr opened this issue Jun 25, 2021 · 28 comments
Labels
enhancement New feature or request

Comments

@Valexr
Copy link

Valexr commented Jun 25, 2021

Сan i expand the disk space after create image & installing system on it?
Ubuntu not enough space...🤓

@Valexr Valexr added the enhancement New feature or request label Jun 25, 2021
@wxw-matt
Copy link

Instead of expanding the disk (disk file) itself, you can add a new disk (disk file) to the Ubuntu and mount the new disk as a new mount point or a subfolder.
https://www.cyberciti.biz/faq/mount-drive-from-command-line-ubuntu-linux/
If you are using LVM to manage your space, you can follow the article to extend the storage

@Valexr
Copy link
Author

Valexr commented Jun 26, 2021

tx @wxw-matt 🤓

@osy osy changed the title Сan i expand the disk space? Change disk image size Jul 5, 2021
@conath
Copy link
Contributor

conath commented Aug 3, 2021

Duplicate of #16

@conath conath marked this as a duplicate of #16 Aug 3, 2021
@conath conath closed this as completed Aug 3, 2021
@johnsaigle
Copy link

Found a simple answer in the support Discord that worked for me:

qemu-img resize /path/to/your/something.qcow2 +SIZE

Then use e.g. gparted within the VM to expand your drive to use the new space.

@fffx
Copy link

fffx commented Sep 27, 2021

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

@jcrf84
Copy link

jcrf84 commented Nov 15, 2021

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@f1yankees
Copy link

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

Same, this breaks the image. For me, it creates a "display output is not active" error at login

@samuela
Copy link

samuela commented Dec 22, 2021

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

Thank you! This is great. Furthermore, I found https://codenotary.com/blog/enlarge-a-disk-and-partition-of-any-linux-vm-without-a-reboot/ useful to resize my linux guest partitions and file system without having to shutdown.

@xJkit
Copy link

xJkit commented Jan 15, 2022

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@jcrf84 @f1yankees

It works on my M1 MacBook Air but with a subtle approach.

I have no qcow2 named disk-0.qcow2, but you can find your own by opening the package contents.

Find your qcow2 file.

What you should to is go to the path ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm ,right click on your UTM file and choose Show Package Contents. Afterwards, find the qcow2 inside the Images/<YOUR OWN NAME>.qcow2, copy that name and do the following command again.

Increase your disk volume

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/<YOUR OWN NAME>.qcow2 +100G 

where +100G is your option.

Allocate the disk

Inside the VM(WIndows 11 ARM), go to Settings > Create and format hard disk partitions, and you will see extra spaces you just created.

@therene
Copy link

therene commented Feb 9, 2022

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@jcrf84 @f1yankees

It works on my M1 MacBook Air but with a subtle approach.

I have no qcow2 named disk-0.qcow2, but you can find your own by opening the package contents.

Find your qcow2 file.

What you should to is go to the path ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm ,right click on your UTM file and choose Show Package Contents. Afterwards, find the qcow2 inside the Images/<YOUR OWN NAME>.qcow2, copy that name and do the following command again.

Increase your disk volume

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/<YOUR OWN NAME>.qcow2 +100G 

where +100G is your option.

Allocate the disk

Inside the VM(WIndows 11 ARM), go to Settings > Create and format hard disk partitions, and you will see extra spaces you just created.

ok, but after that, when I got ,,image resized" in terminal, - what I need to do? Cause in vm windows 11 I see my extra space in ,,create and format hard disk partition", I can do the partition of new disk space, but in the and, when I was try to install big file (60gb game), system inform that ,,im run out of space and choose other disk". Im choosing new disk but nothings change .. :/

@SirusWolf
Copy link

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@jcrf84 @f1yankees
It works on my M1 MacBook Air but with a subtle approach.
I have no qcow2 named disk-0.qcow2, but you can find your own by opening the package contents.

Find your qcow2 file.

What you should to is go to the path ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm ,right click on your UTM file and choose Show Package Contents. Afterwards, find the qcow2 inside the Images/<YOUR OWN NAME>.qcow2, copy that name and do the following command again.

Increase your disk volume

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/<YOUR OWN NAME>.qcow2 +100G 

where +100G is your option.

Allocate the disk

Inside the VM(WIndows 11 ARM), go to Settings > Create and format hard disk partitions, and you will see extra spaces you just created.

ok, but after that, when I got ,,image resized" in terminal, - what I need to do? Cause in vm windows 11 I see my extra space in ,,create and format hard disk partition", I can do the partition of new disk space, but in the and, when I was try to install big file (60gb game), system inform that ,,im run out of space and choose other disk". Im choosing new disk but nothings change .. :/

The same thing, was able to resize but still no change in disk space at all.
tried to create a new mounted-storage but it didn't appear in the VM.
please see attached screenshots.

Note: in the above terminal command you must change the to the name youve given to your vertual machine like i did it to windows, so final command would read ".....Documents/Windows.vm......"

Screen Shot 2022-04-28 at 10 19 41 PM

Screen Shot 2022-04-28 at 10 18 16 PM

Screen Shot 2022-04-28 at 10 10 34 PM

@robigan
Copy link

robigan commented Jul 7, 2022

Out of curiosity, where are you guys getting the proper qemu-img binary from? I installed utm from homebrew but no qemu-* (or more specifically, no qemu-img) binaries are found on my path??

@Valexr
Copy link
Author

Valexr commented Jul 7, 2022

actual version 👍🏻 in App Store

@robigan
Copy link

robigan commented Jul 8, 2022

Interesting, I thought that adding binaries to the path is against apple ToS when using apps on the app store

@verisence
Copy link

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@jcrf84 @f1yankees

It works on my M1 MacBook Air but with a subtle approach.

I have no qcow2 named disk-0.qcow2, but you can find your own by opening the package contents.

Find your qcow2 file.

What you should to is go to the path ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm ,right click on your UTM file and choose Show Package Contents. Afterwards, find the qcow2 inside the Images/<YOUR OWN NAME>.qcow2, copy that name and do the following command again.

Increase your disk volume

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/<YOUR OWN NAME>.qcow2 +100G 

where +100G is your option.

Allocate the disk

Inside the VM(WIndows 11 ARM), go to Settings > Create and format hard disk partitions, and you will see extra spaces you just created.

I had to restart the Windows 11 ARM VM for the changes to take efffect.

@francois-spectre
Copy link

For UTM on macOS:

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/disk-0.qcow2 +10G 

see also: https://superuser.com/questions/24838/is-it-possible-to-resize-a-qemu-disk-image

hey, had tried it several times on my M1 MacBook Air with an Windows 11 VM but somehow it won't work, could you help me?

@jcrf84 @f1yankees

It works on my M1 MacBook Air but with a subtle approach.

I have no qcow2 named disk-0.qcow2, but you can find your own by opening the package contents.

Find your qcow2 file.

What you should to is go to the path ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm ,right click on your UTM file and choose Show Package Contents. Afterwards, find the qcow2 inside the Images/<YOUR OWN NAME>.qcow2, copy that name and do the following command again.

Increase your disk volume

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<YOU VM>.utm/Images/<YOUR OWN NAME>.qcow2 +100G 

where +100G is your option.

Allocate the disk

Inside the VM(WIndows 11 ARM), go to Settings > Create and format hard disk partitions, and you will see extra spaces you just created.

This worked for me except it was for ubuntu and I had to follow this tutorial to resize the partition:
https://packetpushers.net/ubuntu-extend-your-default-lvm-space/#:~:text=Select%20your%20%2Fdev%2Fsda3%20partition,to%20confirm%2C%20and%20hit%20ENTER.

@git0uttaHereIci
Copy link

git0uttaHereIci commented Sep 6, 2022

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/Star\ Wars\ Yoda.utm/Images/data.qcow2 +10G
Image resized.

@git0uttaHereIci
Copy link

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/Star\ Wars\ Yoda.utm/Images/data.qcow2 +10G Image resized.

I did this but am having trouble resizing the image with parted. I don't have enough diskspace to install gparted or grow part.

@mattpopovich
Copy link

mattpopovich commented Oct 25, 2022

For anyone looking to increase their disk image size with an Ubuntu VM, this is 100% the article that you've been looking for. Step by step instructions for a M1 Mac using UTM: https://linux.afnom.net/install_apple/m1.html

I've been trying to figure this out for the last couple hours, and that article got me the solution in ~5mins. People were saying to "use gparted" or a "partition manager", which is correct, but this article actually tells you how to do that.

Hope this helps others as much as it helped me.

@mig8447
Copy link

mig8447 commented Feb 20, 2023

For me the macOS command above didn't work, I instead did

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<VM_NAME>.utm/Data/disk0.img +10G

@duongel
Copy link

duongel commented Jun 30, 2023

For me the macOS command above didn't work, I instead did

qemu-img resize ~/Library/Containers/com.utmapp.UTM/Data/Documents/<VM_NAME>.utm/Data/disk0.img +10G

Worked for me, but the VM does not recognise the increased disk space. Any ideas?

@larsut
Copy link

larsut commented Aug 29, 2023

For anyone looking to increase their disk image size with an Ubuntu VM, this is 100% the article that you've been looking for. Step by step instructions for a M1 Mac using UTM: https://linux.afnom.net/install_apple/m1.html

I've been trying to figure this out for the last couple hours, and that article got me the solution in ~5mins. People were saying to "use gparted" or a "partition manager", which is correct, but this article actually tells you how to do that.

Hope this helps others as much as it helped me.

Updated link: https://linux.afnom.net/install_apple/apple_silicon.html#expanding-your-utm-vms-storage-a-nameutm-storage-expanda

@philmarion
Copy link

philmarion commented Oct 21, 2023

(...2 years laters ) yes, you can!

  1. if your UTM apps is from github, there's no qemu-img command, but :
    brew install qemu will provide it . then, qemu-img /path/disk.qcow2 +10G will resize +10Go
  2. with qemu and an iso of gparted:
qemu-system-x86_64 -m 1024 \ 
 -boot d -cdrom /download_path/gparted-live-1.5.0-6-amd64.iso \
 -usb \
 -device usb-tablet \ 
 -drive file=/path2/disk.qcow2,if=virtio

(path2=/Users/me/Library/Containers/com.utmapp.UTM/Data/Documents/myVM.utm/Data)
note1: be patient with qemu (~30s of blackscreen before boot on gparted)
note2: on linux, I use to resize fs in cli with virt-resize (from libguestfs-tools), but it seems there's no way to get it on macos ?

@petapika
Copy link

I tried a lot of the above with an Arch Linux install as an IMG disk using Apple Virtualization and I was unable to resize my disk.

I was finally able to do it using CloneZilla operating on an imported IMG--> GCOW from Arch and cloning to a fresh disk created in UTM. I moved the new GCOW disk to a new VM without Apple Virtualization and booted from it with a new size and everything worked great.

@msart-it-vision
Copy link

msart-it-vision commented May 8, 2024

I tried to Clone the HD but any App i tried to install on my Win11 ARM in UTM failed either to install or run.

So i tried the mentioned CloneZilla Arm Version as ISO and worked from the first Boot as it should.

Addet NVME Bigger Space in UTM and USB CD with the CloneZilla ISO moved the CD Up in the List booted direct and choosed Pro (r Option to Scale the Source to Destination Size was already selected).

Freakin fast btw.

Without the ability to use the bigger space and scale the Partition it makes no sense, so cloning with a bootable iso is working best.

xD

/clonezilla-live/experimental/arm/3.1.2-6

You can easy Resize in the GUI on Mac:
image

@5alv1
Copy link

5alv1 commented May 8, 2024

Found a simple answer in the support Discord that worked for me:

qemu-img resize /path/to/your/something.qcow2 +SIZE

Then use e.g. gparted within the VM to expand your drive to use the new space.

Is there a way to do that with Apple virtualization?

@msart-it-vision
Copy link

msart-it-vision commented May 9, 2024

You can just go to the Edit of the VM in UTM:
(Mac MBA M2 16GB/1TB/10C)
image
Then Click on the HD in the Sidebar and Resize via the GUI:
image
image
image
image

Then use e.g. gparted within the VM to expand your drive to use the new space.

Or Just start a CloneZilla CD ISO Image and Clone on a NEW NVME with a bigger Size.
This shoud work with any VM.

@sontt9
Copy link

sontt9 commented Nov 12, 2024

  1. Resize on the UTM GUI
  2. Going to the VM, then
# Determine which partition to resize
fdisk -l

# Go into the parted command
parted /dev/vda
# then print the list of partition
print

# resize the partition, with 1 refier to partition number, 100% tell parted to expand to fill the remaining space
resizepart 2 100%

# Exit parted
quit

# Resize the filesystem
resize2fs /dev/vda2

# Verify the new size
df -h

Worked with Macbook Pro M1, and Arch VM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests