Jump to content

Create/Delete Vdisk as I startup/shutdown a VM


Recommended Posts

Hi Guys,

 

I have a rather unique situation. I have a windows VM that runs an app that creates huge amount of temporary data. This data is not useless when the VM is shutdown and data is not reusable.

 

So instead of creating this vdisk and allocating a big space in my SSD, I would like to create this vdisk on the fly as I start my VM. When I shutdown, the vdisk can be automatically remove to space my SSD space for other purpose. Is this possible to do?

 

Apology is this has been asked before. I couldn't find anything related.

 

TIA,

Dex

Link to comment
36 minutes ago, Dexmorgan said:

Hi Guys,

 

I have a rather unique situation. I have a windows VM that runs an app that creates huge amount of temporary data. This data is not useless when the VM is shutdown and data is not reusable.

 

So instead of creating this vdisk and allocating a big space in my SSD, I would like to create this vdisk on the fly as I start my VM. When I shutdown, the vdisk can be automatically remove to space my SSD space for other purpose. Is this possible to do?

 

Apology is this has been asked before. I couldn't find anything related.

 

TIA,

Dex

I don't think there is a way to do via the GUI, QEMU does have a hooks system so you could build a script to add and remove the disk during start up and shutdown.

 

On 6.9.2 and below there is a single file called QEMU and in 6.10 it is possible to have multiple scripts in a qemu.d directory, but you may need to create the directory.

 

Here is the script I use for my USB_Manager plugin.

 

image.thumb.png.3660969b0c1939abfa952d5ccd727bc4.png

 

The files are persistant so no special processing is needed to restore on boot.

 

Here is more info on hooks.

https://libvirt.org/hooks.html

 

 

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.

×
×
  • Create New...