Zeroing out free space without expanding the virtual image
-
Melab
- Posts: 19
- Joined: 1. Jul 2009, 05:37
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows Vista Home Premium
Zeroing out free space without expanding the virtual image
I've noticed and learned that tools like SDelete, nullfile, and zerofree will expand the virtual machine's disk image because they fill everything up with zeros (that is not used space, of course). I am very low on memory. Is there a way I could zero out the space inside without it expanding the image?
-
stefan.becker
- Volunteer
- Posts: 7639
- Joined: 7. Jun 2007, 21:53
Re: Zeroing out free space without expanding the virtual image
http://wiki.winehq.org/MacOSX
http://forums.virtualbox.org/viewtopic.php?f=6&t=22422
Dont know if its work on mac. But on a linux host this windows program with wine is the best solution for cloning and shrinking images.
http://forums.virtualbox.org/viewtopic.php?f=6&t=22422
Dont know if its work on mac. But on a linux host this windows program with wine is the best solution for cloning and shrinking images.
German Howto (Linux): http://www.linuxforen.de/forums/showthread.php?t=236444
User Manual / Download Section: http://www.virtualbox.de/wiki/Downloads
FAQ: http://www.virtualbox.de/wiki/User_FAQ http://forums.virtualbox.org/viewtopic.php?t=8669
User Manual / Download Section: http://www.virtualbox.de/wiki/Downloads
FAQ: http://www.virtualbox.de/wiki/User_FAQ http://forums.virtualbox.org/viewtopic.php?t=8669
-
Melab
- Posts: 19
- Joined: 1. Jul 2009, 05:37
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows Vista Home Premium
Re: Zeroing out free space without expanding the virtual image
Can be applied to snapshots?
Code: Select all
VBoxManage modifyhd <VM>.vdi --compact-
BillG
- Volunteer
- Posts: 5106
- Joined: 19. Sep 2009, 04:44
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows 10,7 and earlier
- Location: Sydney, Australia
Re: Zeroing out free space without expanding the virtual image
I don't follow what you are driving at. Running those tools does not expand the disk image (or reduce it). The purpose of the tool is to convert unused space to zeros so that a disk compacter can reduce the space. A compacter cannot reduce the size of virtual hard disk file (by removing the unused space) until it is zeroed. If a block has been zeroed, it is not copied, so the size of the file is reduced.Melab wrote:I've noticed and learned that tools like SDelete, nullfile, and zerofree will expand the virtual machine's disk image because they fill everything up with zeros (that is not used space, of course). I am very low on memory. Is there a way I could zero out the space inside without it expanding the image?
Bill
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Zeroing out free space without expanding the virtual image
FYI: zeroing unused space does not make the disk smaller, it is now just full of zero bytes. As Bill says you would typically follow this by compacting, as both VBoxManage and CloneVDI will recognize disk blocks which are entirely filled with zeros, and replace them with stubs that don't need host space.
Unfortunately, none of the compaction techniques work on snapshots. If you want to recover disk space you must stop using snapshots.
And incidentally, CloneVDI does work (according to several Mac users) under Wine/WineBottler on a Mac. Discussion here. With CloneVDI you do not need to run sdelete, as it understands the guest filesystem and recovers unused space directly.
Unfortunately, none of the compaction techniques work on snapshots. If you want to recover disk space you must stop using snapshots.
And incidentally, CloneVDI does work (according to several Mac users) under Wine/WineBottler on a Mac. Discussion here. With CloneVDI you do not need to run sdelete, as it understands the guest filesystem and recovers unused space directly.
-
stefan.becker
- Volunteer
- Posts: 7639
- Joined: 7. Jun 2007, 21:53
Re: Zeroing out free space without expanding the virtual image
And CloneVDI is 10 times faster than the sdelete/Compact Method.
German Howto (Linux): http://www.linuxforen.de/forums/showthread.php?t=236444
User Manual / Download Section: http://www.virtualbox.de/wiki/Downloads
FAQ: http://www.virtualbox.de/wiki/User_FAQ http://forums.virtualbox.org/viewtopic.php?t=8669
User Manual / Download Section: http://www.virtualbox.de/wiki/Downloads
FAQ: http://www.virtualbox.de/wiki/User_FAQ http://forums.virtualbox.org/viewtopic.php?t=8669