Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

QEMU - Resize a virtual Disk (from the GUI)

Featured Replies

Hi, I found out that you can resize the Vdisk ONLINE without a shutdown of the VM by using this command in SSH in the Unraid CLI :

 

virsh qemu-monitor-command "NAME_OF_THE_DOMAIN" block_resize  drive-virtio-disk2  100G --hmp

In this command, the "NAME_OF_THE_DOMAIN" is what you have in the GUI when creating/editing a VM (Name).  The "drive-virtio-disk2" is usually the disk (can be any other disk too). 

 

It would be really nice if you could add "right-click" resize disk menu on a Running VM and then select one of the disk that could show-up in a submenu and then ask for the new size (in GB).

 

After that, it's up to the user to go inside his VM (thru RDP or VNC) and rescan the disk (Disk Management in windows) and then "extend" the Partition :)

 

You can find the "virtio-disk" from looking the XML view when editing a VM in the Unraid GUI.  Look for "alias" and you then prepend "drive-" before when running the command to extend the size.   

 

   <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>

 

 

Edited by Pducharme

Does it work for reduce the size off the vdisk? If so, than thats the easiest way to break your VM. 🤨

  • Author
12 hours ago, bastl said:

Does it work for reduce the size off the vdisk? If so, than thats the easiest way to break your VM. 🤨

 

did not try, but probably.  I needed only to increase the size.  If they add it to GUI, they could know the actual size (they display it) and then they could allow only greater size ;) this way it's sure it won't break.

@Pducharme You can resize a vdisk via the gui for a long time already if you not noticed it. But only if the VM is turned off. Leftclick the name of the VM in the VMs tab and you can see the actual size of the VM. Click the number and you can change the value. Last time I tried to reduce the size this way it worked. The issue is, unraid maybe knows how much is allocated, but it doesn't know where blocks are so to say. If your data is at the end of the file, unraid will cut it of. I know, you can reduce the partition size inside the VM and than reduce it, but still thats not a accurate way to do it.

  • Author

@bastl Thanks, didn't know that.  In my case, i needed an Online way of doing it, but in case of offline, it's pretty easy with the details you mentionned.

On 8/6/2019 at 7:40 AM, bastl said:

@Pducharme You can resize a vdisk via the gui for a long time already if you not noticed it. But only if the VM is turned off. Leftclick the name of the VM in the VMs tab and you can see the actual size of the VM. Click the number and you can change the value. Last time I tried to reduce the size this way it worked. The issue is, unraid maybe knows how much is allocated, but it doesn't know where blocks are so to say. If your data is at the end of the file, unraid will cut it of. I know, you can reduce the partition size inside the VM and than reduce it, but still thats not a accurate way to do it.

Having already created a script what increase and decreases the img file its easier and more productive not to turn a running vm , time lost booting . shutting down and reloading all the programs up from boot , could take 10 mins or so , a simple increase by decrease by would be so beneficial to say the least time taken 5 seconds , thats productivity ... and no down time if running servers on vms 

14 hours ago, Whizadree said:

Having already created a script what increase and decreases the img file its easier and more productive not to turn a running vm , time lost booting . shutting down and reloading all the programs up from boot , could take 10 mins or so , a simple increase by decrease by would be so beneficial to say the least time taken 5 seconds , thats productivity ... and no down time if running servers on vms

Serious question, how often do you change the size of your VMs? 100 times a day? 😂

 

The majority of users of Unraid, let me guess 95% or even more using Unraid in their home environment or in small offices. That small portion of "office people" will never use that feature as a "productivity" feature as you called it. To have that feature available via the GUI for everyone would be great as long as it is save. Don't get me wrong, but I have read a lot of people here in the chat that already broke there VMs by reducing the size of a vdisk.

I do this semi-regularly.

 

I have a base VM images that I use when deploying different OSs. Usually these are minimum size, and get expanded as required depending on use-case.

+1

31 minutes ago, -Daedalus said:

I have a base VM images that I use when deploying different OSs. Usually these are minimum size, and get expanded as required depending on use-case.

Not discounting the value of the suggestion, which I personally have no need for but certainly can see a valid use case, but I'm wondering about your workflow. Normally vdisk files are sparse, so no matter how large or small you allocate, they only take up as much space as actually used by the files inside. So, why not just set up the base images with the size you need to begin with? It's not going to change the amount of space they occupy.

No reason. Just a minimalist thing I suppose.

 

Well, actually, it's also to try and prevent Windows from filling up images with junk. Seems to be like cats in that regard: It expands to fill all available space of a container.

On 8/8/2019 at 7:51 AM, bastl said:

Serious question, how often do you change the size of your VMs? 100 times a day? 😂

 

The majority of users of Unraid, let me guess 95% or even more using Unraid in their home environment or in small offices. That small portion of "office people" will never use that feature as a "productivity" feature as you called it. To have that feature available via the GUI for everyone would be great as long as it is save. Don't get me wrong, but I have read a lot of people here in the chat that already broke there VMs by reducing the size of a vdisk.

no abt 3 times a month and also testing servers so once the standard 30gb is complete then its current long winded to keep expanding , just added another 12tb 6tb x 2 so i dont go all in i keep expanding them by 500gb until the user wishes to add more only when and only when do they really need it i will expand , my wife vm , sons vm . security system ,gaming vm/ steam os / and my remote backup linux system for when im away are only upgraded as and when it reduces the want to download and install everything online and in sight 

at present i just use separate scripts to expand 500g at a time , for each vm and i also do a copy prior  , no screwups ever  as the img gets automatically dumped into the 20TB Backup once the script runs again it removes the previous 

regarding reducing , thats something you have to fully understand , !! WARNING !! it theres no difference in accidentally removing and removing vm + disk . 

truthfully i have never gone down only expanded , yet if a feature would ever exist a double confirm is all thats needed and maybe a backup just incase . 

regarding the % of users 5% is not a bad amount of users considering how many  use ups settings , the use of CA and installing an incorrect plugin that you dont know how to properly operate can kill a server as quickly as a negative downgrade in vm image . its a setting thats there for usefulness to some not all . its also the users operational knowledge and competency , if you dont know what you are doing and you ^^^^ it up , do users have to go without because of the few that bork their systems through no fault of their own ?

 

Edited by Whizadree

6 hours ago, Squid said:

If you don't switch the vdisk type, the image will always grow, and never shrink, as space once allocated is never released by the vdisk.  This lets the vdisk shrink automatically.

https://forums.unraid.net/topic/51703-vm-faq/#comment-557606

 

theres a note there that says 
 

>>>Note: If after this you edit the VM using the GUI editor these changes will be lost and will need to be redone.

if the option was in the GUI to add that unmap option , would it help?

 

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.