VirtualBox

Posted on Sa 29 April 2017 in Notebook

Shrink a vdi VirtualBox disk image

  • Run defrag in the guest (Windows only)
  • Nullify free space:

With a Linux Guest run this:

cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

With a Windows Guest, download SDelete from Sysinternals and run this:

sdelete.exe c: -z
  • Shutdown the guest VM
  • Now run VBoxManage's modifymedium command:

On Linux:

vboxmanage modifymedium disk /path/to/thedisk.vdi --compact

Source: https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size

Repack Windows DVD

mkisofs \
    -iso-level 4 \
    -l \
    -R \
    -UDF \
    -D \
    -b boot/etfsboot.com \
    -no-emul-boot \
    -boot-load-size 8 \
    -hide boot.catalog \
    -eltorito-alt-boot \
    -eltorito-platform efi \
    -no-emul-boot \
    -b efi/microsoft/boot/efisys.bin \
    -o /tmp/test.iso .