Jump to content

macOS - vDisk can write inside and outside the hard disk and disk will run full at some point


Recommended Posts

The installation of macOS went smoothly. As storage space for the VM I chose 500 GB m2. But this was not passed through. I inserted the vDisk there and chose almost 500 GB. Normally the VM can only read and write to this file, right? But every time I work with the VM, install something or e.g. render a video, the disk space inside the VM decreases, BUT the hard disk is full. Now it gets completely crazy: when I delete a file inside the VM, the space is made available again, but the hard disk itself remains at the storage level, meaning: sooner or later it will run full. Do you have any idea what I am doing wrong? Is this a mistake? By the way, the same thing happens when the hard disk is scanned. It is not clear to me how this can happen. The VM would be allowed to write from the file beyond its right side, which is nonsense.

Thanks a lot!

Link to comment

Vdisks are sparse files, which means they can show the full capacity as available to the VM, but only use the actual amount of space on the host drive. Deleting a file normally inside the VM doesn't clear out the data, it just shows it as available, so the amount of space used by the vdisk file doesn't ever decrease, it just keeps growing until it hits the full allocated size.

 

There are settings you can use for a windows VM to allow the space to be reclaimed, but I don't know if it can be done with a hackintosh VM.

Link to comment
7 hours ago, Rorschach said:

Do you have any idea what I am doing wrong? Is this a mistake?

Yes it can be done, with the following settings:

1- settings for the disk (this is an example, important is sata and to add cache='none' io='native' discard='unmap' :

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source file='/mnt/user/domains/BigSur/vdisk3.img'/>
      <target dev='hdd' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>

2- add qemu custom arg:

  <qemu:commandline>
    <qemu:arg value='-set'/>
    <qemu:arg value='device.sata0-0-3.rotation_rate=1'/>
  </qemu:commandline>

Note the sata0-0-3 matches unit='3'

 

3- force trim on mac os vm (in mac os terminal):

sudo forcetrim enable

Now when you delete a file in the mac os vm the host will sync.

Edited by ghost82
  • Like 1
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...