**VIDEO GUIDE** How to both Expand or Shrink a Vdisk


Recommended Posts

3 hours ago, gridrunner said:

thanks 1812

 

no, THANK YOU. I feel that for about 1/4-1/3 of my posts on here, I end up sending people a link to one of your vids. So much easier than explaining it myself (or when I don't know how to do it myself!)

Link to comment
  • 11 months later...
  • 9 months later...

Thanks @SpaceInvaderOne for the guide.

 

I just tried to shrink my Windows VM from 120G to 60G. Something is not working. I followed all steps and reduced the VM disk size. It shows correctly in Unraid in both "capacity" and "allocation" with the new 60G. Also, good news is that I can start the VM. So far so good. If I access "computer management", it still shows the higher amount of 120G (55G as my disk and 65G as unassigned).

 

Any thoughts?

Link to comment
3 hours ago, steve1977 said:

If I access "computer management", it still shows the higher amount of 120G (55G as my disk and 65G as unassigned).

 

Any thoughts?

Sometimes windows gets stuck thinking nothing has changed. Try making a small change in disk management to force windows to reread the partition table. Something like add a 1GB extended partition or something.

  • Like 1
Link to comment
  • 8 months later...

Unfortunately, this video doesn't consider the case where windows has placed some random partition to the right side of your main partition. From what I can tell, when this happens you cant extend (its greyed out) the volume to your newly added space.

 

At the time of writing, I haven't figured out how to get around this...

 

image.png.d74d2103d58c1187fc5755f0c136b0d9.png

Edited by WexfordStyle
Link to comment
58 minutes ago, WexfordStyle said:

Unfortunately, this video doesn't consider the case where windows has placed some random partition to the right side of your main partition. From what I can tell, when this happens you cant extend (its greyed out) the volume to your newly added space.

 

At the time of writing, I haven't figured out how to get around this...

 

image.png.d74d2103d58c1187fc5755f0c136b0d9.png

Download a live iso of gparted. Set that iso as boot for the VM. Run gparted, move and expand partitions around as needed, reboot, done.

Link to comment
1 hour ago, jonathanm said:

Download a live iso of gparted. Set that iso as boot for the VM. Run gparted, move and expand partitions around as needed, reboot, done.

Thanks for the reply @jonathanm.

 

I did try gparted but I was to lazy to try and get it to work. I ended up downloading some shady piece of software which allowed me to get rid of the random windows partition in the way (risky probably?). Anyway it ended up working.

 

On a less positive note, China is probably using my VM in a botnet right now. 🤦‍♂️

Link to comment
  • 2 weeks later...
  • 2 months later...
On 1/10/2020 at 6:06 PM, tll002 said:

How would I shrink the vdisk of a linux (ubuntu) VM?

Depends on a bunch of variables. In a nutshell, you have to get the data inside the vdisk to give up the extra space it has allocated, then shrink the container vdisk. The vdisks are by default sparse, which introduces yet another variable.

 

It's not a simple thing with a short answer, it's probably easier to make a backup of just the data inside the vdisk and create a new vdisk of the size you want and restore your data there.

Link to comment
  • 2 weeks later...
  • 1 month later...

Hello everyone. Just started running unraid and have everything mostly setup now. I've made a few errors along the way, but one of them I'd like to see if I can get some help finding a solution to so I don't end up having to reinstall my main OS VM (Linux Mint) again now that I have everything mostly the way I want it.

 

I first started off saving VM's to the cache drive not thinking this was a issue (learned that one fast when mover ran...), so I then migrated that disk over and used the unassigned plugin to keep my fastest drive (1TB nvme) off the array to be ONLY used for VM's... Well when I set that up, I wrongly partitioned the entire 1TB for the Linux VM, not thinking ahead. I would like to now re-partition that drive, but you can not do this while the VM is running.

 

I have gparted live ISO file in my ISO's share and assign it as the OS install image, but I can not seem to figure out how to boot from that image. It just keeps booting into Mint. I've tried pressing DELETE, F1 and F2 (most seem to agree it should be F1 based on what I am reading) during the slash screen. What am I doing wrong here?

 

I'm running Unraid Version 6.9.0-beta1 2020-03-06

VM Bios selected is i440fx-4.2

Link to comment
  • 2 weeks later...

Update on my issue: It does appear the setting is no longer available on the edit VM page but it can be changed. You need to do it from the VM list. Click on the name of the VM in the list and it will expand to show more details. From this additional details is where you can edit the vdisk size.

  • Like 1
Link to comment
  • 1 year later...

Hi all I'm on 6.9.1 and I've been able to follow(to reduce windows VM size) up until the SSH section where when I enter the qemu as per video it detects 'raw' and will not let me proceed(in spaceinvaders video there is a shorter similar earning but then says image resized....I don't have that and am pulling my hair out trying to workout what I need to do exactly to fix this...I can't for the life of me google the correct searches to elevate the coding to approve this. Thank you to anyone who can solve this for me!

 

 

 

 

 

 

Link to comment
  • 2 weeks later...

Can someone confirm that this still works for shrinking a VM disk??

I've tried qemu-img resize Server_2016.img 30G to which I get
WARNING: Image format was not specified for 'Server_2016.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-img: Use the --shrink option to perform a shrink operation.
qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.


Would someone be able to help, cause I have no idea what I'm doing when It comes to Linux commands xD????
I'm using Unraid version 6.9.2

Edited by Reggie997
Link to comment
15 hours ago, Reggie997 said:

Can someone confirm that this still works for shrinking a VM disk??

I've tried qemu-img resize Server_2016.img 30G to which I get
WARNING: Image format was not specified for 'Server_2016.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-img: Use the --shrink option to perform a shrink operation.
qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.


Would someone be able to help, cause I have no idea what I'm doing when It comes to Linux commands xD????
I'm using Unraid version 6.9.2

15 hours ago, Lunch said:

I got lost on this last month too for the same error. Trawled online for guides and couldn't find any relevant information so I'd love to know too!!



Ok so i figured it out thanks to this post on the forum:



What I needed to do was add --shrink in between "qemu-img resize" and the .img you whish to change.
So I needed to do "qemu-img resize --shrink Server_2016.img 30G" of course the .img name will be different from what I have as that is the name my VM.

 

  • Like 3
Link to comment
  • 8 months later...

I am really struggling with reducing my vdisk size from 500gb too 240gb..

 

I have already done the volume shrink inside of the vm and shut it down.

 

whenever i try too connect with the ssh part (putty, nothing mentioned in the video about which terminal spaceinvader is using) too resize the vdisc i get too the password entering part and the terminal stops accepting any other keyboard inputs other than enter so i cannot enter my password.......

 

is this doable from unraids own terminal? if so how/what commands do i need please?

Edited by Knight2339
Link to comment
  • 1 year later...

Hello,

 

nice explantation for qemu resizing, but bad syntax.

 

qemu-img resize vdisk1.img 500G like in the video will not work, triggering a warning like:

WARNING: Image format was not specified for 'vdisk1.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.


better use 

qemu-img resize -f raw vdisk1.img 500G
 

 

Link to comment
  • 6 months later...

I'm having some trouble shrinking my Ubuntu Server 22.04 vdisk from 200 GiB to 40 GiB.

 

I booted into a live distro, used GParted to shrink the primary partition to 30 GiB (to expand up to 40 later), and confirmed there are no partitions after it. Booted back into Ubuntu and it worked perfectly. Shut it back down and made a backup. Resized the .img file with qemu-img to 40G, and now suddenly it will no longer boot. It gives up waiting for the root filesystem to become available.

 

Since I had a backup, I tried multiple different variations of the command, to no avail:

  • qemu-resize --shrink vdisk1.img 40G
  • qemu-resize --shrink vdisk1.img 199G
  • qemu-resize --shrink -f raw vdisk1.img 40G
  • qemu-resize --shrink -f raw vdisk1.img 199G

Am I missing a critical step for Ubuntu/Linux that isn't required for shrinking a Windows vdisk? Thanks in advance.

 

1479292535_Screenshot2024-02-26165646.thumb.png.0d635531d35730dc45dc9942e4f7df4a.pngimage.thumb.png.4e2d954baee6065b3316aae19438df0f.png

Edited by LeeNeighoff
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.