Bonjour,
A lot of the work has been done. The size of /dev/sda2 has been reduced by 28G. Take a look at the picture below. It would be interesting to recover the space thus freed for another virtual machine or to store files under the host. But how?
I did try to reduce the size of the virtual machine in the following way: C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd E:\Leloup\LinuxMint19Mate.vdi --resize 12000 (the desired size in Mio) but it failed.
Do you have any idea?
Regards,
Leloup
How to shrink a VirtualBox
How to shrink a VirtualBox
- Attachments
-
- Shrinked_Space_02.png (45.8 KiB) Viewed 3692 times
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: How to shrink a VirtualBox
Clone the drive using CloneVDI. Be sure to select the "Keep UUID" and "Compact" options. The clone VDI will be a drop in replacement for the current one, but smaller.
Re: How to shrink a VirtualBox
Bonjour mpack
Thank you for your message. Cloning with your appli allows to gain about 360M on the size of the VDI file.
The goal here is different. It is to reduce the size of the file by 28G by deleting the freed space as shown on the picture.
Does anyone have an idea?
Regards,
Leloup
Thank you for your message. Cloning with your appli allows to gain about 360M on the size of the VDI file.
The goal here is different. It is to reduce the size of the file by 28G by deleting the freed space as shown on the picture.
Does anyone have an idea?
Regards,
Leloup
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: How to shrink a VirtualBox
If you only got back 360M then it was probably not done correctly. If you don't set the Compact option then nothing will happen, except you'll have a copy of the VDI. And if CloneVDI compaction doesn't work then nothing else will work either, since it means that the drive is already compacted.
Re: How to shrink a VirtualBox
Sorry. I don't know how to do subtraction.
The use of your application allows to gain 1358M or 1.3G. ~ - 16% That's not bad.
To recap, right now we are gaining real memory space on the hard drive, while I was looking to decrease the size of the virtual memory by 28G by removing the non-allocated space.
So I wonder if there is any point in reducing the size of the virtual memory.
The use of your application allows to gain 1358M or 1.3G. ~ - 16% That's not bad.
To recap, right now we are gaining real memory space on the hard drive, while I was looking to decrease the size of the virtual memory by 28G by removing the non-allocated space.
So I wonder if there is any point in reducing the size of the virtual memory.
- Attachments
-
- cocoClone.png (20.44 KiB) Viewed 3624 times
-
- coco.png (9.62 KiB) Viewed 3624 times
-
- CloneVDI.png (7.5 KiB) Viewed 3624 times
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: How to shrink a VirtualBox
Ok, the terms you are using are unfamiliar, but I believe that "virtual memory" refers to the capacity of the virtual hard drive, the size you selected when you created the drive.
If you have already reduced the partition sizes inside the guest OS then the guest OS can no longer access that disk space. CloneVDI will have ensured that no physical (host) disk space is allocated to unpartitioned parts of the virtual drive. In other words, the unaccessible (unpartitioned) parts of the virtual drive now occupy no space on the host, and being partitioned the guest OS can no longer write to those areas so cannot cause blocks to be allocated to them.
In which case: no, you will not see any significant change in host file size if you reduced the virtual drive capacity.
If you have already reduced the partition sizes inside the guest OS then the guest OS can no longer access that disk space. CloneVDI will have ensured that no physical (host) disk space is allocated to unpartitioned parts of the virtual drive. In other words, the unaccessible (unpartitioned) parts of the virtual drive now occupy no space on the host, and being partitioned the guest OS can no longer write to those areas so cannot cause blocks to be allocated to them.
In which case: no, you will not see any significant change in host file size if you reduced the virtual drive capacity.