How to reduce the not allocated memory space?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Leloup78
Posts: 150
Joined: 21. Oct 2017, 15:13

How to reduce the not allocated memory space?

Post by Leloup78 »

Bonjour,
How to shrink the not allocated memory space of the VM?
UUID: 78945.................a
Parent UUID: base
State: created
Type: normal
Location C:/...................machine.vdi
Storage format: VDI
Format version: dynamic default
Capacity: 64228MBytes
Size on disk: 64030MBytes
Encryption: disabled
Property: AllocationBlockSize=1048576

Initial state of the VM
VM_intial_state.png
VM_intial_state.png (52.5 KiB) Viewed 1550 times
Expected VM status
VM_expecting_state.png
VM_expecting_state.png (42.96 KiB) Viewed 1550 times
Regards,
Leloup78
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to reduce the not allocated memory space?

Post by scottgus1 »

"Memory" is RAM. Your screenshots are referring to Disk Space.

There is nothing in Virtualbox that adjusts partitions inside a VM's OS. You have to adjust the partitions using your favorite built-in or 3rd-party partition manager.

Your screenshots are showing the Gparted partition manager. How to use Gparted isn't in the scope of the Virtualbox forum. You should ask on a Gparted forum how to proceed.
Leloup78
Posts: 150
Joined: 21. Oct 2017, 15:13

Re: How to reduce the not allocated memory space?

Post by Leloup78 »

Happy New Year scottgus1!
I should have explained a little better. In fact, I'm trying to reduce the size of the VM in order to free up the 14.87Gio = (62.72Gio - 48.85Gio) that appear in gray in the image at the very top. I'd be happy with 12 or 13Gio.
I've made a bunch of attempts but I'm beginning to wonder if it's possible.
For more details, you can see: viewtopic.php?t=22422&start=1335
Regards,
Leloup
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to reduce the not allocated memory space?

Post by scottgus1 »

OK< so you're trying to compact the VM. Compacting and CloneVDI only compact when the space inside the VM OS is empty. If for some reason the OS has marked the space as used by data, then the space may not compact.

I'd check on what your VM is doing with that empty space and see if it's a used partition. Then try Gparted inside the VM to expand the yellow partition to fill up the gray space. Once the OS is using the whole space, then the OS can mark disk space as unused and you may be able to compact better.

I would still use CloneVDI: it does not write to the original disk file, making the compacting safer.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to reduce the not allocated memory space?

Post by scottgus1 »

BTW, viewtopic.php?p=545479#p545479 from poster Tki2000 points out you're using LVM, which isn't supported by CloneVDI. You may be stuck.
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: How to reduce the not allocated memory space?

Post by fth0 »

I'll make an educated guess that the key to your problem is the key in your screenshot (pun intended ;)), which probably indicates that you're not only using LVM, but additionally disk encryption. If that's the case, the blocks of zeros created by zerofree are encrypted to blocks of seemingly random data, so VBoxManage --compact cannot work as expected.

One possible strategy would be to temporarily undo the disk encryption, then to zero fill and compact, and finally to re-enable the disk encryption.
Post Reply