主机和来宾之间的 VDI 使用不一致

VDI usage inconsistent between host and guest

vbox 5.0.24ubuntu 16.04 在主机和客户机 (myguest) 上具有动态分配的 VDI。

当我在下面检查时,为什么主机和来宾之间的 VDI 使用情况大不相同?

$ du -h myguest.vdi # from the host
5G

$ df -h --total # from the guest
...       used
...
total ... 2G

@解决方案

  • 将客户机引导至 recovery mode [Esc, Enter]
  • 选择drop to root shell [Down, Enter]
  • 转到Maintenance [Enter]
  • # mount -o remount,ro /dev/sda[id] /
  • #zerofree/dev/sda[id]
  • # shutdown -P now

  • 通过

  • 从主机缩小来宾 VDI
  • $ VBoxManage modifyhd [guest].vdi --compact

参考:

https://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi https://unix.stackexchange.com/questions/11100/how-to-make-ext4-filesystem-sparse http://ubuntuforums.org/archive/index.php/t-908128.html