0

I'm using VirtualBox with some virtual machines, but it just increases the disk size every time I open and close it without doing anything, I asked several communities, and they said that swap files are created and not enough RAM and stuffs like that, how do I clear this "increased spaces for no reason" files? It must have a solution, cause when I reinstall the VM disk before doing anything and after the disk ate so many spaces, the disk size reset to the size first when I install it and nothing is changed, I've searched on the internet and google gave me some solutions like shrinking VirtualBox to save spaces and stuffs like that. I want to stop this increase for no reason, or a solution to clear those "ate spaces for no reason" files manually, what do I do? Shrink VirtualBox by following this link?: https://www.maketecheasier.com/shrink-your-virtualbox-vm/

4
  • 2
    What do you mean virtualbox increase spaces for no reason? Whenever you have a virtual machine - you have a virtual disk (VDI) - and you set the VDI size up front (when you created the VM). Depends on the VDI you could do "Dynamically allocate" vs "Fixed Size". Fixed Size will allocate 1 file straight away. Dynamically allocate will start from as close as possible from 0, but as soon as disk space is required - the file will grow to the maximum of what you set. Please clarify what disk size you had in mind as this is not very clear as it is written.
    – Darius
    Oct 12, 2021 at 7:13
  • Inside the VM you can try to execute the command fstrim ... on each mounted writable partition. Then VirtualBox should recognize the free blocks and use them the next time in need to write a block. Hopefull the image should not grow as long as you regularity execute fstrim and do not use more HDD space in the VM.
    – Robert
    Oct 12, 2021 at 9:43
  • 1
    Further to @Darius, thee dynamically allocated drives pretty much can only get bigger, as they don't know of files, only of block devices, so when a file is deleted the space is not cleared.
    – davidgo
    Oct 25, 2021 at 23:14
  • je, so I found a solution that you can shrink the VM, so deleted files are cleared in the host machine. maketecheasier.com/shrink-your-virtualbox-vm
    – D YAY
    Oct 30, 2021 at 0:53

0

You must log in to answer this question.