virtualbox 6.1.26
the space inside the virtual machine is occupied by only 6.5 GB along with the swap file, but the vbox hard disk image.vdi takes up 19 gb of space on a real machine, is that how it should be? when installing a virtual machine, a dynamic hard disk of 20 GB was selected
virtualbox takes up a lot of space
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: virtualbox takes up a lot of space
Space occupied on the host depends on how many sectors contain data - i.e. how many have ever been written to by the guest OS. Nothing else. For example, it has nothing to do with how much data in files is currently reported by the guest filesystem. Compacting a drive can reduce the VDI host size again, but that would be pointless if the current size is the natural size it wants to be, i.e. it would just puff back out again.
Also, people often neglect to look at other partitions on the same virtual drive. E.g. if it's a Linux drive then it will often contain a swap partition (not a swap file), and that partition will have a size related to how much RAM you gave the VM. That partition doesn't contain any files at all, but it will be full of data.
Also, people often neglect to look at other partitions on the same virtual drive. E.g. if it's a Linux drive then it will often contain a swap partition (not a swap file), and that partition will have a size related to how much RAM you gave the VM. That partition doesn't contain any files at all, but it will be full of data.
-
- Posts: 231
- Joined: 1. Jan 2017, 09:16
- Primary OS: MS Windows 7
- VBox Version: PUEL
- Guest OSses: Ubuntu 16.04 x64, W7
Re: virtualbox takes up a lot of space
@OP: In case that was a little more involved than you were ready for, the short answer to
> is that how it should be?
is "realistically, yes".
As mpack says, you can TRY to reduce it periodically, but you'll just be wasting time (and SSD wear, if that applies), and it'll end up back there very quickly. As he also points out though, if you've got an 8GB swap partition etc in there too, compacting it will be an even more futile exercise than it already is otherwise.
> is that how it should be?
is "realistically, yes".
As mpack says, you can TRY to reduce it periodically, but you'll just be wasting time (and SSD wear, if that applies), and it'll end up back there very quickly. As he also points out though, if you've got an 8GB swap partition etc in there too, compacting it will be an even more futile exercise than it already is otherwise.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: virtualbox takes up a lot of space
IME the only time compaction is warranted is (a) immediately before shrinking or deleting a partition, (b) after some kind of "oops" that puffed the VDI to max (picked at creation) size, for example - doing a low level disk check (which you should never do, as physical damage needs to be fixed on the host).
Otherwise you just have to be aware that VMs need lots of disk space, and plan accordingly. There are some things you can definitely do to minimize the hoggage, for example by avoiding all use of snapshots. If you created a 40GB drive and then add 10 snapshots then that theoretically could add up to 440GB disk space used, all of which has to be kept online. Without snapshots the same theoretical max is 40GB.
Otherwise you just have to be aware that VMs need lots of disk space, and plan accordingly. There are some things you can definitely do to minimize the hoggage, for example by avoiding all use of snapshots. If you created a 40GB drive and then add 10 snapshots then that theoretically could add up to 440GB disk space used, all of which has to be kept online. Without snapshots the same theoretical max is 40GB.